11 Linux commands that are very useful but rarely known

Source: Internet
Author: User
Tags curl socket ping and traceroute

The Linux command line attracts most Linux enthusiasts. A normal Linux user typically has about 50-60 commands to handle daily tasks. Linux commands and their transformations are the most valuable treasures for Linux users, Shell scripting programmers, and administrators. Some Linux commands are rarely known, but they are handy and useful, whether you're a novice or an advanced user.

Fewer people know about Linux commands

The purpose of this article is to introduce some of the less-known Linux commands that will effectively help you manage your desktop/server.

1. sudo!! Command

Run without a specific input sudo command, an error with no permissions is given. Well, you don't need to rewrite the entire command, just type '!! ' You can grab the last command.

  1. $ apt-get Update
  2. E:could not open lock File/var/lib/apt/lists/lock-open (13:permission denied)
  3. E:unable to lock directory/var/lib/apt/lists/
  4. E:could not open lock File/var/lib/dpkg/lock-open (13:permission denied)
  5. E:unable to lock the Administration directory (/var/lib/dpkg/), are for you root?
  6. $ sudo!!
  7. Sudoapt-get Update
  8. [sudo] password forserver:
  9. ...
  10. ..
  11. Fetched 474 KB in16s (28.0 kb/s)
  12. Reading Package Lists ... Done
  13. server@localhost:~$

2. Python command

The following command produces a simple Web page that displays the folder structure tree via HTTP, which can be accessed through the browser on port 8000 until the interrupt signal is issued.

    1. # python-m Simplehttpserver

3. MTR command

Most of us are familiar with Ping and traceroute. What about the MTR command to bring the two-order function into one? If MTR is not installed on your machine, apt or yum need the package.

    1. $ sudo apt-get install MTR (on Debian based Systems)
    2. # yum Install MTR (on Red Hat based Systems)

Now run the MTR command to start viewing the MTR running host and google.com Direct network connection.

    1. # mtr google.com

MTR command

4. Ctrl+x+e command

This command is useful for administrators and developers. To automate daily tasks, administrators need to open the editor by entering VI, VIM, nano, and so on.

By simply tapping the "ctrl-x-e" from the command line, you can start working in the editor.

5. NL command

The number of rows that the NL command added to the file. A file called ' One.txt ' whose contents are (Fedora, Debian, Arch, Slack, and SuSE), adding line numbers to each line. First, use the Cat command to display the contents of the "One.txt" file.

    1. # Cat One.txt
    2. Fedora
    3. Debian
    4. Arch
    5. Slack
    6. Suse

Now run the NL command to display the line number in the way you want to add it.

    1. # NL One.txt
    2. 1 Fedora
    3. 2 Debian
    4. 3 Arch
    5. 4 slack
    6. 5 SuSE

6. Shuf command

The "shut" command randomly selects rows/files/folders from a file or folder. First, use the LS command to display the contents of the folder.

  1. # ls
  2. Desktop Documents Downloads Music Pictures public Templates Videos
  3. # ls | Shuf (Shuffle Input)
  4. Music
  5. Documents
  6. Templates
  7. Pictures
  8. Public
  9. Desktop
  10. Downloads
  11. Videos
  12. # ls | SHUF-N1 (pick on random selection)
  13. Public
  14. # ls | Shuf-n1
  15. Videos
  16. # ls | Shuf-n1
  17. Templates
  18. # ls | Shuf-n1
  19. Downloads

Note: You can replace ' N1 ' with ' N2 ' to output two random selections or use N3, N4, and other digital outputs for arbitrary random selections.

7. SS Command

"SS" represents the socket statistics. This command investigates the socket and displays information similar to the netstat command. It can display more TCP and state information than other tools.

  1. # SS
  2. State Recv-q send-q The local address:port Peer address:port
  3. Estab 0 0 192.168.1.198:41250 *.*.*.*:http
  4. Close-wait 1 0 127.0.0.1:8000 127.0.0.1:41393
  5. Estab 0 0 192.168.1.198:36239 *.*.*.*:http
  6. Estab 310 0 127.0.0.1:8000 127.0.0.1:41384
  7. Estab 0 0 192.168.1.198:41002 *.*.*.*:http
  8. Estab 0 0 127.0.0.1:41384 127.0.0.1:8000

8. Last Order

The "Last" command displays historical information about the user who logged on to it. This command displays a list of users of Logged-in and Logged-out and their TTY ' s by searching for the file "/var/log/wtmp".

  1. # last
  2. Server pts/0:0 Tue Oct 12:03 still logged in
  3. Server tty8:0 Tue Oct 12:02 still logged in
  4. ...
  5. ...
  6. (Unknown tty8:0 Tue Oct 22 12:02-12:02 (00:00)
  7. Server pts/0:0 Tue Oct 22 10:33-12:02 (01:29)
  8. Server tty7:0 Tue Oct 22 10:05-12:02 (01:56)
  9. (Unknown tty7:0 Tue Oct 22 10:04-10:05 (00:00)
  10. Reboot system boot 3.2.0-4-686-pae Tue Oct 22 10:04-12:44 (02:39)
  11. Wtmp begins Fri Oct 4 14:43:17 2007

9. Curl Ifconfig.me

So how do you get your external IP address? Using Google? Then this command will output your external IP address at your terminal.

    1. # Curl Ifconfig.me

Note: You may not follow the curl package, you need Apt/yum to follow the package.

Tree command

Gets the structure of the current folder in a tree format.

Pstree.

This command displays all currently running processes and their associated child processes, with a tree format similar to the ' Trees ' command

So far so much. In the next article, I'll cover some interesting linux commands that few other people know about. By that time the connection Tecmint remained tuned. Love and sharing will help us spread.

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.