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.
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. 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.
2. 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.
The code is as follows |
Copy Code |
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.
The code is as follows |
Copy Code |
1.# mtr google.com |
3. Tree command
Gets the structure of the current folder in a tree format.
4. Pstree
This command displays all currently running processes and their associated child processes, with a tree format similar to the ' Trees ' command
5. 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.
6. 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".
The code is as follows |
Copy Code |
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 |
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.
The code is as follows |
Copy Code |
1.# SS 2.State recv-q send-q 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. 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.
The code is as follows |
Copy Code |
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.
9. 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.
The code is as follows |
Copy Code |
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.
The code is as follows |
Copy Code |
1.# NL One.txt 2.1 Fedora 3.2 Debian 4.3 Arch 5.4 Slack 6.5 SuSE
|
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.
# python-m Simplehttpserver
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.
The code is as follows |
Copy Code |
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:~$
|
So far so much.