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.
$ 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/), are for you root?
$ sudo!!
Sudoapt-get Update
[sudo] password forserver:
...
..
Fetched 474 KB in16s (28.0 kb/s)
Reading Package Lists ... Done
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.
# 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.
$ sudo apt-get install MTR (on Debian based Systems)
# 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.
# 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.
# Cat One.txt
Fedora
Debian
Arch
Slack
Suse
Now run the NL command to display the line number in the way you want to add it.
# 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 in put)
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 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.
# SS
State Recv-q send-q The 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 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".
# 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 do you get your external 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, 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