Useful Linux commands

There is nothing wrong to be smart on command line. Someone who is very familiar with Linux commands and can make best use of it is considered as the sign of smartness. Lets try some useful Linux commands.

kill command

Kill all instances of Skype

killall -9 skype

Note: This will kill all the instance of Skype that are running on the system. 

find command

Find files that are bigger than 100M inside var directory

find /var/ -type f -size +1048576

mv command

Move everything except one directory to that directory.

mv !(source) source/ 

Note: Let say we have a directory called source and we want to move everything 
but the source directory to that source directory. We can easily do that using
the above command.

shutdown command

If the system needs to shutdown after 10 minutes then the following command will do it.

shutdown -h +10

shutdown command

If user wants to see the command from history and when that command ran, it can be easily done by setting the HISTTIMEFORMAT. Afterwards run the history command and it will show history command with date time

export HISTTIMEFORMAT='%F %T %t'
history | grep node

Base64 decode from command line

base64 commands can be used to decode the base64 encoded string

base64 -d <<< ZGFnZW4uc2VfbWNVc2VySWRfMzM0NzA9

Comments