Q 1. How to remove everything except for a list of files?
rm -rf !(file1 | file2 | file3 |...)
Q 2. How to remove all hidden files in current directory?
rm -f .??* .[^.]
Q 3. How to save file in vim when forgetting to use sudo?
:w !sudo tee %
Q 4. How to edit multiple file simultaneously with vim?
vim -o file1 file2 file3
Q 5. How to find and remove broken symbolic links/
fins -L . -type l -delete
Note: If you simply want to find broken symbolic links but without removing them:
find -L -type l
find . xtype l
Q 6. How to monitor top 10 processes using the most CPU?
watch -n1 "ps aux --sort -pcpu | head -n10"
Q 7. How to check battery of your wireless mouse?
upower --dump
Q 8. How to find date and time when your linux was installed?
tune2fs -l /dev/sda1 | grep "Filesystem created"
Q 9. How to combine multiple PDF files into one PDF file
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
Q. 10 How to SSH to a remote server via a jump server in the middle?
open ssh connection through a jump server
ssh -J user@jump_server user@remote_server
No comments:
Post a Comment