You get full control over every module of the system which could be configured and restricted in the way you need. Here are some useful commands. Also, Read: 10 Reasons why Linux is better for programmers

1 : Command: ifconfig

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.

ifconfig, when invoked with no arguments will display all the details of currently active interfaces. If you give the interface name as an argument, the details of that specific interface will be displayed.

Display Details of All interfaces Including Disabled Interfaces

 Disable an Interface

 Enable an Interface

 Assign IP-address to an Interface

Change MTU

2 : Command: netstat

netstat command displays various network related information such as network connections, routing tables, interface statistics, masquerade connections, multicast memberships etc eth0   Link encap:Ethernet  HWaddr 00:2D:32:3E:39:3B inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0 inet6 addr: fe80::21d:92ff:fede:499b/64 Scope:Link UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 RX packets:977839669 errors:0 dropped:1990 overruns:0 frame:0 TX packets:1116825094 errors:8 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2694625909 (2.5 GiB)  TX bytes:4106931617 (3.8 GiB) Interrupt:185 Base address:0xdc00

List All Network Ports

List All TCP Ports

Show Statistics for All Ports

3 : Command: nslookup

A network utility program used to obtain information about Internet servers. As its name suggests, the utility finds name server information for domains by querying DNS. Proto RefCnt Flags       Type       State         I-Node   Path unix  2      [ ACC ]     STREAM     LISTENING     741379   /run/user/user1/keyring-I5cn1c/gpg unix  2      [ ACC ]     STREAM     LISTENING     8965     /var/run/acpid.socket unix  2      [ ACC ]     STREAM     LISTENING     18584    /tmp/.X11-unix/X0 unix  2      [ ACC ]     STREAM     LISTENING     741385   /run/user/user1/keyring-I5cn1c/ssh unix  2      [ ACC ]     STREAM     LISTENING     741387   /run/user/user1/keyring-I5cn1c/pkcs11 unix  2      [ ACC ]     STREAM     LISTENING     20242    @/tmp/dbus-ghtTjuPN46 unix  2      [ ACC ]     STREAM     LISTENING     13332    /var/run/samba/winbindd_privileged/pipe unix  2      [ ACC ]     STREAM     LISTENING     13331    /tmp/.winbindd/pipe unix  2      [ ACC ]     STREAM     LISTENING     11030    /var/run/mysqld/mysqld.sock unix  2      [ ACC ]     STREAM     LISTENING     19308    /tmp/ssh-qnZadSgJAbqd/agent.3221 unix  2      [ ACC ]     STREAM     LISTENING     436781   /tmp/HotShots unix  2      [ ACC ]     STREAM     LISTENING     46110    /run/user/ravisaive/pulse/native unix  2      [ ACC ]     STREAM     LISTENING     19310    /tmp/gpg-zfE9YT/S.gpg-agent Proto Recv-Q Send-Q Local Address           Foreign Address         State tcp        0      0 localhost:mysql         :                     LISTEN tcp        0      0 *:5901                  :                     LISTEN tcp        0      0 *:5902                  :                     LISTEN tcp        0      0 *:x11-1                 :                     LISTEN tcp        0      0 *:x11-2                 :                     LISTEN tcp        0      0 *:5938                  :                     LISTEN tcp        0      0 localhost:5940          :                     LISTEN tcp        0      0 ravisaive-OptiPl:domain :                     LISTEN tcp        0      0 ravisaive-OptiPl:domain :                     LISTEN tcp        0      0 localhost:ipp           :                     LISTEN tcp        0      0 ravisaive-OptiPle:48270 ec2-23-21-236-70.c:http ESTABLISHED tcp        0      0 ravisaive-OptiPle:48272 ec2-23-21-236-70.c:http TIME_WAIT tcp        0      0 ravisaive-OptiPle:48421 bom03s01-in-f22.1:https ESTABLISHED tcp        0      0 ravisaive-OptiPle:48269 ec2-23-21-236-70.c:http ESTABLISHED tcp        0      0 ravisaive-OptiPle:39084 channel-ecmp-06-f:https ESTABLISHED … 4994239 total packets received 0 forwarded 0 incoming packets discarded 4165741 incoming packets delivered 3248924 requests sent out 8 outgoing packets dropped Icmp: 29460 ICMP messages received 566 input ICMP message failed. ICMP input histogram: destination unreachable: 98 redirects: 29362 2918 ICMP messages sent 0 ICMP messages failed ICMP output histogram: destination unreachable: 2918 IcmpMsg: InType3: 98 InType5: 29362 OutType3: 2918 Tcp: 94533 active connections openings 23 passive connection openings 5870 failed connection attempts 7194 connection resets received ….

Query Mail Exchanger Record

Query Name Server

Query DNS Record

Query Start of Authority

4 : Command: dig

a dig is a tool for querying DNS nameservers for information about host addresses, mail exchanges, nameservers, and related information. This tool can be used from any Linux (Unix) or Macintosh OS X operating system. The most typical use of dig is to simply query a single host Address:                 192.168.1.1#53 Non-authoritative answer: abc.com       mail exchanger = 0 smtp.secureserver.net. abc.com       mail exchanger = 10 mailstore1.secureserver.net. Address:                 192.168.1.1#53 Non-authoritative answer: abc.com       nameserver = ns3404.com. abc.com       nameserver = ns3403.com. Address:                 192.168.1.1#53 Non-authoritative answer: abc.com       mail exchanger = 10 mailstore1.secureserver.net. abc.com       mail exchanger = 0 smtp.secureserver.net. abc.com       nameserver = ns06.domaincontrol.com. abc.com       nameserver = ns3404.com. abc.com       nameserver = ns3403.com. abc.com       nameserver = ns05.domaincontrol.com. Address:                 192.168.1.1#53 Non-authoritative answer: abc.com origin = ns3403.hostgator.com mail addr = dnsadmin.gator1702.hostgator.com serial = 2012081102 refresh = 86400 retry = 7200 expire = 3600000 minimum = 86400

Turn Off Comment Lines

Turn Off Authority Section

Disable All Section at Once

5 : Command: top

 6 : Command: mkfs.ext4

This command creates a new ext4 file system on the specified device, if the wrong device is followed after this command, the whole block will be wiped and formatted, hence it is suggested not to run this command unless and until you understand what you are doing. Mkfs.ext4 /dev/sda1 (sda1 block will be formatted) mkfs.ext4 /dev/sdb1 (sdb1 block will be formatted) ;; global options: +cmd ;; Got answer: ;; -»HEADER< ;; global options: +cmd top – 14:06:45 up 10 days, 20:57,  2 users,  load average: 0.10, 0.16, 0.21 Tasks: 240 total,   1 running, 235 sleeping,   0 stopped,   4 zombie %Cpu(s):  2.0 us,  0.5 sy,  0.0 ni, 97.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st KiB Mem:   2028240 total,  1777848 used,   250392 free,    81804 buffers KiB Swap:  3905532 total,   156748 used,  3748784 free,   381456 cached PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+ COMMAND 23768 ravisaiv  20   0 1428m 571m  41m S   2.3 28.9  14:27.52 firefox 24182 ravisaiv  20   0  511m 132m  25m S   1.7  6.7   2:45.94 plugin-containe 26929 ravisaiv  20   0  5344 1432  972 R   0.7  0.1   0:00.07 top 24875 ravisaiv  20   0  263m  14m  10m S   0.3  0.7   0:02.76 lxterminal 1 root      20   0  3896 1928 1228 S   0.0  0.1   0:01.62 init 2 root      20   0     0    0    0 S   0.0  0.0   0:00.06 kthreadd 3 root      20   0     0    0    0 S   0.0  0.0   0:17.28 ksoftirqd/0 5 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kworker/0:0H 7 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kworker/u:0H 8 root      rt   0     0    0    0 S   0.0  0.0   0:00.12 migration/0 9 root      20   0     0    0    0 S   0.0  0.0   0:00.00 rcu_bh 10 root      20   0     0    0    0 S   0.0  0.0   0:26.94 rcu_sched 11 root      rt   0     0    0    0 S   0.0  0.0   0:01.95 watchdog/0 12 root      rt   0     0    0    0 S   0.0  0.0   0:02.00 watchdog/1 13 root      20   0     0    0    0 S   0.0  0.0   0:17.80 ksoftirqd/1 14 root      rt   0     0    0    0 S   0.0  0.0   0:00.12 migration/1 16 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kworker/1:0H 17 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 cpuset 18 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 khelper 19 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kdevtmpfs 20 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 netns 21 root      20   0     0    0    0 S   0.0  0.0   0:00.04 bdi-default 22 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kintegrityd 23 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 kblockd 24 root       0 -20     0    0    0 S   0.0  0.0   0:00.00 ata_sff

7 :  Command: vi/emacs/nano

vi (visual), emacs, nano are some of the most commonly used editors in Linux. They are used often to edit text, configuration,… files. A quick guide to work around vi and nano is, emacs is a.

vi-editor

nano editor

ctrl +x (to close the editor). It will show output as: Click ‘y’ to yes and enter the file name, and you are done. Y Yes N No           ^C Cancel<

8 : Command: rsync

Rsync copies files and has a -P switch for a progress bar. So if you have rsync installed, you could use a simple alias. Now try to copy a large file in the terminal and see the output with the remaining items, similar to a progress bar. Moreover, Keeping and Maintaining backup is one of the most important and boring works a system administrator, needs to perform. Rsync is a very nice tool (there exists, several other) to create and maintain the backup, in the terminal. sending incremental file list Note: -z for compression, -v for verbose and -r for recursive sent 2883830 bytes  received 31 bytes  5767722.00 bytes/sec total size is 2882771  speedup is 1.00

9 : Command: mysqldump

From the name, it is understood what this command actually stands for, from the name of this command.mysqldump commands dump (backups) all or a particular database data into a given a file. For example, Note: mysqldump requires MySQL to be running and correct password for authorization

10 : Command: uptime

You have just connected to your Linux Server Machine and founds Something unusual or malicious, what you will do? Guessing…. NO, definitely not you could run uptime to verify what happened actually when the server was unattended.

11 : Command: talk

An enhancement to write command, talk command lets you talk to the logged-in users. Note: If the talk command is not installed, you can always apt or yum the required packages. OR

12 : Command: w

what command ‘w’ seems you funny? But actually, it is not. it’s a command, even if it’s just one letter long! The command “w” is a combination of uptime and who commands given one immediately after the other, in that order. USER     TTY      FROM              [email protected]   IDLE   JCPU   PCPU WHAT server   tty7     :0               14:06    4:43m  1:42   0.08s pam: gdm-passwo server   pts/0    :0.0             14:18    0.00s  0.23s  1.65s gnome-terminal server   pts/1    :0.0             14:47    4:43   0.01s  0.01s bash