2017-7-18-Daily blog-little-known 10 commands about Linux. doc

Source: Internet
Author: User

The purpose of this article is to introduce some people who are less known Linux commands, they are sure to help you manage your desktop / server efficiently.

1. sudo!! Command

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

$ apt-get Update

E:could not open lock File/var/lib/apt/lists/lock-open (13:permission denied)

E:unable to lock directory/var/lib/apt/lists/

E:could not open lock File/var/lib/dpkg/lock-open (13:permission denied)

E:unable to lock the Administration directory (/var/lib/dpkg/), is you root?

$ sudo!!

Sudoapt-get Update

[sudo] password forserver:

...

..

Fetched 474 KB in16s (28.0 kb/s)

Reading Package Lists ... Done

[Email protected]:~$

2. Python commands

The following command produces a pass HTTP displays a simple Web page of the folder tree that can be accessed through the browser on the port 8000 until the interrupt signal is signaled.

# python-m Simplehttpserver

3. MTR Command

Most of us are familiar with ping and traceroute. What about the MTR commands that combine the functions of two commands . If the mtr is not installed on your machine,apt or yum needs the package.

$ sudo apt-get install MTR (on Debian based Systems)

# yum Install MTR (on Red Hat based Systems)

now run the MTR command to start looking at the network connection of the host and google.com that are running on the mtr .

# 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 "ctrl-x-e" from the command line, you can start working in the editor.

5. NL Command

The "NL command " adds the number of lines to the file. A file called ' one.txt ' whose contents are in each line (Fedora,Debian,Arch ,Slack , and Suse), add line numbers to each line. First, use the cat command to display the file contents of "One.txt" .

# Cat One.txt

Fedora

Debian

Arch

Slack

Suse

now run the "NL command "todisplay it as a line number to add.

# NL One.txt

1 Fedora

2 Debian

3 Arch

4 slack

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.

# ls

Desktop Documents Downloads Music Pictures public Templates Videos

# ls | Shuf (Shuffle Input)

Music

Documents

Templates

Pictures

Public

Desktop

Downloads

Videos

# ls | SHUF-N1 (pick on random selection)

Public

# ls | Shuf-n1

Videos

# ls | Shuf-n1

Templates

# ls | Shuf-n1

Downloads

Note: You can replace ' N1 ' with ' N2 ' to output two random selections or use n3, n4 and other arbitrary random selection of digital output.

7. SS Command

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

# SS

State recv-q send-q Local address:port Peer address:port

Estab 0 0 192.168.1.198:41250 *.*.*.*:http

Close-wait 1 0 127.0.0.1:8000 127.0.0.1:41393

Estab 0 0 192.168.1.198:36239 *.*.*.*:http

Estab 310 0 127.0.0.1:8000 127.0.0.1:41384

Estab 0 0 192.168.1.198:41002 *.*.*.*:http

Estab 0 0 127.0.0.1:41384 127.0.0.1:8000

8. Last command

The last command displays historical information about the user who was logged on. This command displays logged-in and logged-out and their /var/log/wtmp by searching for the file " TTY ' s List of users.

# last

Server pts/0:0 Tue Oct 12:03 still logged in

Server tty8:0 Tue Oct 12:02 still logged in

...

...

(Unknown tty8:0 Tue Oct 22 12:02-12:02 (00:00)

Server pts/0:0 Tue Oct 22 10:33-12:02 (01:29)

Server tty7:0 Tue Oct 22 10:05-12:02 (01:56)

(Unknown tty7:0 Tue Oct 22 10:04-10:05 (00:00)

Reboot system boot 3.2.0-4-686-pae Tue Oct 22 10:04-12:44 (02:39)

Wtmp begins Fri Oct 4 14:43:17 2007

9. Curl Ifconfig.me

so how to get your external What about the IP address? Use Google? Then this command will output your external IP address at your terminal .

# Curl Ifconfig.me

Note: You may not follow the Curl package and you need to Apt/yum to follow the package.

Ten. Tree command

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

Pstree.

This command displays all currently running processes and their associated sub-processes, and outputs a tree-like format similar to the ' tree ' command

so far so much. In the next article, I'll cover some other interesting Linux commands that few people know about . Then connect the tecmint to stay tuned. Liking and sharing will help us spread.

2017-7-18-Daily blog-little-known 10 commands about Linux. doc

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.