Here are some quick tricks to utilize the power of your command lines to the max!
We always say that the most powerful Linux tools are its Command lines. This is because you can do about everything right from your command line. You can easily explain your computer exactly what you require and it comes back to you with appropriate results. Infact there are some commands that make this tool even more powerful! Here we bring to you a list of 10 such commands that work like energy drinks for you Linux machines! |
Must Check : Linux Password working | etc/Passwd File Format
1. Runing the last command as Root
sudo !!
Also if you want to open some file to make changes and right when want to save it, you realise that you forgot to open it as root, there is nothing to worry. The command above is your solution.
2. To find your external IP address.
curl ifconfig.me
3. Run your previous command with replacing “foo” with “bar”
^foo^bar
Or alternatively you can use the below command:
!!:gs/foo/bar
Also after running a long command, if you realise that you have made a mistake, this command helps you replace that one word instead of running the whole command again, unlike the previous command which can only replace foo.
4. Auto-empty any file without removing it
> file.txt
5. Execute command without saving it in the history
6. Slick way to copy or backup a file before you edit it.
cp filename{,.bak}
7. Traceroute is a nice command but how about a single network diagnostic tool that can combine traceroute with ping? mtr is your command.
mtr www.Smarttricks.co.nr
8. To Clear your terminal's screen
ctrl-l
9. List of commands you use most often
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
10. Saving the file you edited in vim/vi without the required permissions
:w !sudo tee %
0 comments:
Post a Comment