Important Advanced Linux Commands for Programmers - Helpwalaa - Free IT Updates & Opportunities

New Updates

Important Advanced Linux Commands 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.
# ifconfig eth0

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

2 : Command: netstat
netstat command displays various network related information such as network connections, routing tables, interface statistics, masquerade connections, multicast memberships etc

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.

Query Mail Exchanger Record
[root@root ~]$ nslookup -query=mx abc.com

Server:                     192.168.1.1

Address:                 192.168.1.1#53


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


Turn Off Comment Lines


[root@root ~]$ dig abc.com +nocomments ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +nocomments ;; global options: +cmd ;abc.com.                                       IN             A abc.com.                       14400   IN             A               40.216.66.239 ;; Query time: 418 msec ;; SERVER: 192.168.1.1#53(192.168.1.1) ;; WHEN: Sat Jun 29 13:53:22 2013 ;; MSG SIZE  rcvd: 45


5 : Command: top

Displays the processes of CPU. This command refreshes automatically, by default and continues to show CPU processes unless interrupt-instruction is given.

 [root@root ~]$ 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)

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

    [root@root ~]$ touch a.txt (creates a text file a.txt)


    [root@root ~]$ vi a.txt (open a.txt with vi editor)


[press ‘i’ to enter insert mode, or you won’t be able to type-in anything]


     echo "Hello" (your text here for the file)

* alt+x (exit insert mode, remember to keep some space between the last letter.


* ctrl+x command or your last word will be deleted).


* :wq! (saves the file, with the current text, remember ‘!’ is to override).


nano editor

 [root@root ~]$ nano a.txt (open a.txt file to be edited with nano)

edit, with the content, required

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.


alias cp='rsync -aP'

Now try to copy a large file in terminal and see the output with 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.


[root@root ~]$ rsync -zvr IMG_5267\ copy\=33\ copy\=ok.jpg ~/Desktop/


sending incremental file list


IMG_5267 copy=33 copy=ok.jpg


sent 2883830 bytes received 31 bytes 5767722.00 bytes/sec


total size is 2882771 speedup is 1.00

Note: -z for compression, -v for verbose and -r for recursive


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,


[root@root ~]$ mysqldump -u root -p --all-databases > /home/server/Desktop/backupfile.sql

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.


[root@root ~]$ uptime


14:37:10 up 4:21, 2 users, load average: 0.00, 0.00, 0.04

11 : Command: talk

An enhancement to write command, talk command lets you talk to the logged in users.


[root@root ~]$ talk ravisaive

Note: If talk command is not installed, you can always apt or yum the required packages.


[root@root ~]$ yum install talk

OR


[root@root ~]$ apt-get install talk

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.


[root@root ~]$ w


15:05:42 up 4:49, 3 users, load average: 0.02, 0.01, 0.00


USER TTY FROM LOGIN@ 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


    Thanks!! 

Most Popular