Top 10 Handy LINUX Commands

Handy commands will always help you to do your daily tasks on a LINUX system or server. You just need to remember and use them on time and you will perfectly get best results. Few Commands are given as under which can save your lot of time.

1. pgrep

pgrep will give you the currently running processes and lists the process IDs which matches the selection criteria.

pgrep ssh

2. Execute The Last Executed Command

If you like to reissue a command again you need to type the whole path and command again to get the results, you can just enter the under given command;


3. Execute The Last Command Starting With some letter

If you want to execute a command a command from history starting with the letter S you can use the following command: This will execute the last command used on the command line that started with s.


4. Run a Command Repeatedly and Display the Output

It will run a command repeatedly, displaying its output. This allows you to watch the program output change over time. By default, the program is running every 2 seconds.

watch -d ls -l

The above given command will watch the current directory for any file changes and highlight the change when it occurs.

5. Save Quickly in VI/VIM

I like to use vi editor for all kinds of modifications and changing in any file in LINUX or UNIX system because it offers very handy and great features. I would like to share one very good feature of vi editor over here. If you like to close the vi editor at once and also want to save the data use the under given command;

exit insert mode by pressing escape, hold shift, and hit z twice.

6. Quickly Log Out of a Terminal

If you want to logout of the terminal any time with a quickly manner please use the under given command.


7. Navigate to the Last Directory

cd - will take you to the last directory you were in.

8. Make Parent Directories

mkdir -p /home/itm/make/all/of/these/directories/ will create all directories as needed even if they do not exist.

9. Delete the Entire Line

If you have typed a long string on console and you don’t need it any more, you don’t need to waste a handsome amount of time deleting it or pressing the backspace you can simple press the under given combination of keys on keyboard.


10. Set the Time stamp of a File

touch -c -t 0801010800 filename.c will show the time stamp as 2008-01-01 8:00. The format is (YYMMDDhhmm).

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.