Ten little-known Linux commands (3)

Source: Internet
Author: User
We continue with the third part of the 10 little-known Linux Command series. Maybe you already know these commands, so you are undoubtedly an experienced Linux user who is interested in exploring them. Read: 10 little-known Linux commands (1) and 10 little-known Linux commands (2) 22. ^ foo Linux Commands

We continue to Part 3 of "10 little-known Linux command Series. Maybe you already know these commands, so you are undoubtedly an experienced Linux user who is interested in exploring them.

Read: 10 little-known Linux commands (1) and 10 little-known Linux commands (2)

22. ^ foo ^ bar command

Run the last modified command in an instance. Suppose I need to run a command'Ls-l'To list in detail'Desktop'Contents under the Directory. Unexpectedly, you hit'Lls-l'. So you need to repeat the entire command or use the navigation key to edit the previous command. This is very painful when your command is very long.

avi@localhost:~/Desktop$ lls -l bash: lls: command not foundavi@localhost:~/Desktop$ ^lls^ls ls -l total 7489440 drwxr-xr-x 2 avi  avi       36864 Nov 13  2012 101MSDCF -rw-r--r-- 1 avi  avi      206833 Nov  5 15:27 1.jpg -rw-r--r-- 1 avi  avi      158951 Nov  5 15:27 2.jpg -rw-r--r-- 1 avi  avi       90624 Nov  5 12:59 Untitled 1.doc

Note:: In the above replace, we use"Typo (replaced) original_command (original command)". Warning! This command may be very dangerous! If you intentionally or unintentionally error the system command or any imageRm-rfThat's a risky command!

23.> file.txt command

This command will refresh the file content without deleting and then create the same file. This command is useful when we need to output multiple times or record logs on the same file.

I have a lot of text'Test.txt'File in my'Desktop.

avi@localhost:~/Desktop$ cat test.txt Linux GNU Debian Fedora kali ubuntu git Linus Torvaldsavi@localhost:~/Desktop$ > test.txt avi@localhost:~/Desktop$ cat test.txt

Note:: Again, this command may be dangerous! Never refresh the system file or the content of a log file. If you do this, you may encounter serious problems!

24. at Command

'At'Commands are similar to cron commands and can be used to schedule a task or execute commands at a specific time.

avi@localhost:~/Desktop$ echo "ls -l > /dev/pts/0" | at 14:012

Or

avi@localhost:~/Desktop$ echo "ls -l > /dev/pts/0" | at 2:12 PM

Sample output

-rw-r--r-- 1 avi  avi      220492 Nov  1 13:49 Screenshot-1.png -rw-r--r-- 1 root root        358 Oct 17 10:11 sources.list -rw-r--r-- 1 avi  avi  4695982080 Oct 10 20:29 squeeze.iso ....-rw-r--r-- 1 avi  avi       90624 Nov  5 12:59 Untitled 1.doc -rw-r--r-- 1 avi  avi       96206 Nov  5 12:56 Untitled 1.odt -rw-r--r-- 1 avi  avi        9405 Nov 12 23:22 Untitled.png

Note:: Echo"Ls-l"Means to put this string of commands (here isLs-l) Output on the standard terminal. You can replace'Ls-l'.

>: Redirected output

/Dev/pts/0: This is the output device and/or file, which is output to the specified place. it is output to the terminal (/dev/pts/0 ).

For me, myTtyIn/Dev/pts/0. You can useTtyCommand to check yourTty.

avi@localhost:~/Desktop$ tty /dev/pts/0

Note::'At'Will be executed as soon as the system time matches to a specific time.

25. du-h-max-depth = 1 Command

The following command outputs the subdirectory size of the current directory in the form of human readable.

avi@localhost:/home/avi/Desktop# du -h --max-depth=1 38M     ./test 1.1G    ./shivji 42M     ./drupal 6.9G    ./101MSDCF 16G .

Note:: The above command is very useful in checking system usage.

26. expr command

'Expr'Is not a little-known command. This command is useful when calculating simple arithmetic values in the terminal.

avi@localhost:/home/avi/Desktop# expr 2 + 3 5avi@localhost:/home/avi/Desktop# expr 6 – 3 3avi@localhost:/home/avi/Desktop# expr 12 / 3 4avi@localhost:/home/avi/Desktop# expr 2 \* 9 18
27. look command

Query words from the English dictionary on the terminal to prevent confusion. For example, I can't remember whether it should be carrier or carieer.

avi@localhost:/home/avi/Documents# look carCara Cara's …... carps carpus carpus's carrel carrel's carrels carriage carriage's carriages carriageway carriageway's carried carrier carrier's carriers carries …... caryatids

The above Command will display all words in the dictionary starting with 'car. I got what I was looking.

28. yes command

Another command is usually not used frequently, but is useful in script language and system management.

This command will continuously output the given string until it is interrupted by your interrupt command.

avi@localhost:~/Desktop$ yes "Tecmint is one of the best site dedicated to Linux, how to" Tecmint is one of the best site dedicated to Linux, how to Tecmint is one of the best site dedicated to Linux, how to Tecmint is one of the best site dedicated to Linux, how to Tecmint is one of the best site dedicated to Linux, how to ……...Tecmint is one of the best site dedicated to Linux, how to Tecmint is one of the best site dedicated to Linux, how to Tecmint is one of the best site dedicated to Linux, how to
29. factor command

Factor is actually a mathematical command. This command outputs the factors of all given numbers.

avi@localhost:~/Desktop$ factor 22 22: 2 11avi@localhost:~/Desktop$ factor 21 21: 3 7avi@localhost:~/Desktop$ factor 11 11: 11
30. ping-I 60-a IP_address

We use the ping command to check whether the server is connected. I usually ping google to check if I have connected to the Internet.

When you wait for or keep staring at your terminal and wait for a response from a command or a connection to the server, it is sometimes quite irritating.

How is there a sound when the server is connected )?

avi@localhost:~/Desktop$ ping -i 60 -a www.google.com PING www.google.com (74.125.200.103) 56(84) bytes of data. 64 bytes from www.google.com (74.125.200.103): icmp_req=1 ttl=44 time=105 ms 64 bytes from 74.125.200.103: icmp_req=2 ttl=44 time=281 ms

Note: When you find that the command does not return a sound. Make sure that your system is not mute and the sound is already in'Sound preferences)'Enable and make sure that the check'Enable window and window sound'.

31. tac command

This command is very interesting. it will output the content of the text file in reverse order. That is, from the last row to the first row.

Under the home directory, my documentsdirectory contains a 35.txt file. Run the cat command to check the content.

avi@localhost:~/Documents$ cat 35.txt

Sample output

  1. Linux is built with certain powerful tools, which are unavailable in windows.
  2. One of such important tool is Shell Scripting. Windows however comes with such a tool but as usual it is much weak as compared to it's Linux Counterpart.
  3. Shell scripting/programming makes it possible to execute command (s), piped to get desired output in order to automate day-to-day usages.

Now we can use the tac command to reverse the file content ).

avi@localhost:~/Documents$ tac 35.txt 

Sample output

  1. Shell scripting/programming makes it possible to execute command (s), piped to get desired output in order to automate day-to-day usages.
  2. One of such important tool is Shell Scripting. Windows however comes with such a tool but as usual it is much weak as compared to it's Linux Counterpart.
  3. Linux is built with certain powerful tools, which are unavailable in windows.

Now it is over. If you know other Linux commands that are rarely known, you can comment on them below. you can include them in future articles.

Don't forget to give us valuable comments. I will soon send another interesting article. Stay tunedTecmint.

Http://www.tecmint.com/10-lesser-known-commands-for-linux-part-3/:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.