Advanced Commands for Middle-Level Linux Users
You might have found the first article very much useful and this article is an extension of the 20 Useful Linux Commands for all. Now It’s time to show you some other very useful advanced Linux commands. In this article, we discussed the commands which a middle-level user requires to manage his own system.
head: Displaying the Beginning of a File
The head command, as the name implies, displays the top of the file. When used without any option, it displays the first 10 lines of the argument file. To specify line count and display, say, the first five lines. Use - symbol, followed by a numeric argument
$ head -5 server.log
head is often used with the grep command to restrict the display to a few lines.
$ grep “img src.*png” index.html | head -5
tail: Displaying the End of a File
Complementing its head counterpart, the tail command displays the end of the file. It provides an additional method of addressing lines, and like head, it displays the last 10 lines when used without arguments.
$ tail -3 server.log
ps: Process Status
The ps command is used to display the attributes of a process.
PID TTY TIME CMD
6373 pts/0 00:00:00 bash
11901 pts/0 00:00:00 ps
-u Displaying Processes of a User
-a Displaying all User Processes
-f Full Listing
who and w: Know the Users
There are two commands which display an informative listing of users- who and w. who produces a simple three-columnar output:
The w command produces a more detailed output of users’ activities.
date: Display the System Date
You can display the current date with date command.
The command can also be used with suitable format specifiers as arguments.
$ date +%m
or month name:
$ date +%h
cal: The Calendar
cal is a handy tool that you can invoke anytime to see the calendar of any specific month or a complete year.
Su Mo Tu We Th Fr Sa
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
To see the calendar for the month of December
$cal -m dec
netstat: Displaying the Network Parameters
netstat command displays various network related information such as network connections, routing tables, etc…
List All Routing Table
$ netstat -rn
List All TCP Ports
$ netstat -at
ifconfig: Configuring the Network Interfaces
ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
Set the IP address of your interface
$ ifconfig eth0 192.168.1.10
Enable/Disable an Interface
$ ifconfig eth0 up
$ ifconfig eth0 down
Originally published at https://codinghub.net