11:43 PM Some amazing command shortcuts in Linux |
Hello Linuxmen Today in tis article we shall learn cool command execution tricks in Linux/Unix. Many times we have to run the same command or last command or any one command in recent history in our lovely Terminal/Putty. We press up button several times and search. Lets try and implement some easier methods. 1. Execute the last command. To execute last command we can simply press up button and press enter. Or We can use "!!" and press enter. This will do the same.
2. Execute a matching command from history You can execute a last matching command using start with characters. For example last commad starting with 'ho' :
3. Execute 2nd last command or nth last command. See the comamnd below to understand it. You can execute any nth last command using "!-n" . For example, !-2 for 2nd last !-3 for 3rd last command.
4. See the most recent comamnd using history You can use history command to see your last commands. It shows 1000 last commands. You can see last ten command using history|head.
5. Access the argument of last comaand You can access the argument of last command using !$. See the below example to understand it. 6. Search and excute a command using CTRL +r Here comes the best one. This is my favourite and most commonly used. Just press ctrl+r at the terminal/Putty anf enter starting character of your command, The prompt shows you complete command, press enter to execute it.
If you like, it share it!! |
|
Related blogs
You may also like to see:
[2016-01-23] | [Open System-Linux] |
Some useful examples of netstat command in Linux for network statistics |
[2015-03-23] | [Open System-Linux] |
FSCK : Checking and reparing filesystems in Linux |
[2014-12-24] | [Open System-Linux] |
XARGS command in Linux with examples |
[2016-12-25] | [Open System-Linux] |
Guide for working with zipped and archived files in Linux/AIX |
[2014-11-25] | [Open System-Linux] |
DMESG command in Linux : to display or control kernel ring buffer |
Total comments: 1 | |
0
Spam
| |