Close Menu
Technotification
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Technotification
    • Home
    • News
    • How To
    • Explained
    • Facts
    • Lists
    • Programming
    • Security
    • Gaming
    Technotification
    Home › Programming › Important Advanced Linux Commands for Programmers

    Important Advanced Linux Commands for Programmers

    By Harshit SatyaseelAugust 1, 2023
    Facebook Twitter Reddit LinkedIn
    linux commands

    Linux is one of the most popular operating systems for developers and hackers. Today we are going to highlight some of the advanced Linux commands which are being used by regular Linux users in order to make their system keep running smoothly and well configured. Linux is such an OS that could be configured in any required way, as per the user’s knowledge and requirement.

    Contents

    • Advanced Linux Commands for Programmers
      • 1. ifconfig
      • 2. netstat
      • 3. nslookup
      • 4. dig
      • 5. top
      • 6. mkfs.ext4
      • 7. vi/emacs/nano
      • 8. rsync
      • 9. mysqldump
      • 10. uptime
      • 11. talk
      • 12. w

    Advanced Linux Commands for Programmers

    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: Why Programmers Should Use Linux

    1. 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

    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

    • Display Details of All interfaces Including Disabled Interfaces

    # ifconfig -a

    •  Disable an Interface

    # ifconfig eth0 down

    •  Enable an Interface

    # ifconfig eth0 up

    •  Assign IP-address to an Interface

    # ifconfig eth0 192.168.2.2

    • Change MTU

    # ifconfig eth0 mtu XX

    2. netstat

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

    • List All Network Ports

    [root@root ~]$ netstat -a

    Active UNIX domain sockets (servers and established)

    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

    • List All TCP Ports

    [root@root ~]$ netstat -at

    Active Internet connections (servers and established)

    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

    …

    • Show Statistics for All Ports

    [root@root ~]$ netstat -s

    Ip:

    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

    ….

    3. 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

    Non-authoritative answer:

    abc.com       mail exchanger = 0 smtp.secureserver.net.

    abc.com       mail exchanger = 10 mailstore1.secureserver.net.

    • Query Name Server

    [root@root ~]$ nslookup -type=ns abc.com

    Server:                     192.168.1.1

    Address:                 192.168.1.1#53

    Non-authoritative answer:

    abc.com       nameserver = ns3404.com.

    abc.com       nameserver = ns3403.com.

    • Query DNS Record

    [root@root ~]$ nslookup -type=any abc.com

    Server:                     192.168.1.1

    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.

    • Query Start of Authority

    [root@root ~]$ nslookup -type=soa abc.com

    Server:                     192.168.1.1

    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

    4. 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

      • Turn Off Authority Section

    [root@root ~]$ dig abc.com +noauthority

    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +noauthority

    ;; global options: +cmd

    ;; Got answer:

    ;; ->>HEADER<

    • Disable All Sections at Once

    [root@root ~]$ dig tecmint.com +noall

    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +noall

    ;; global options: +cmd

    5. 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

    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

    6. 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. vi/emacs/nano

    vi (visual), emacs, and 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

    ctrl +x (to close the editor). It will show output as:

    Save modified buffer (ANSWERING “No” WILL DESTROY CHANGES)?

    Y Yes

    N No           ^C Cancel<

    Click ‘y’ to yes and enter the file name, and you are done.

    8. 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 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 others) 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. 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. 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. talk

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

    [root@root ~]$ talk ravisaive

    Note: If the 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. 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

    Share. Facebook Twitter LinkedIn Tumblr Reddit Telegram WhatsApp
    Harshit Satyaseel
    • Website
    • LinkedIn

    Research Intern, INSA Rouen | Technical Writer, Self-learner and Tech exuberant person.

    Related Posts

    The Best Python Libraries for Data Visualization in 2025

    April 1, 2025

    Is C++ Still Relevant in 2025 and Beyond?

    February 20, 2025

    5 Best Programming Languages for Machine Learning in 2025

    February 18, 2025

    10 Must-Have Chrome Extensions for Web Developers in 2025

    February 17, 2025

    Difference Between C, C++, C#, and Objective-C Programming

    February 16, 2025

    How to Learn Programming Faster and Smarter in 2025

    February 14, 2025
    Lists You May Like

    10 Sites to Watch Free Korean Drama [2025 Edition]

    January 2, 2025

    10 Best RARBG Alternative Sites in April 2025 [Working Links]

    April 1, 2025

    The Pirate Bay Proxy List in 2025 [Updated List]

    January 2, 2025

    10 Best Torrent Search Engine Sites (2025 Edition)

    February 12, 2025

    10 Best GTA V Roleplay Servers in 2025 (Updated List)

    January 6, 2025

    5 Best Torrent Sites for Software in 2025

    January 2, 2025

    1337x Alternatives, Proxies, and Mirror Sites in 2025

    January 2, 2025

    10 Best Torrent Sites for eBooks in 2025 [Working]

    January 2, 2025

    10 Best Anime Torrent Sites in 2025 [Working Sites]

    January 6, 2025

    Top Free Photo Editing Software For PC in 2025

    January 2, 2025
    Pages
    • About
    • Contact
    • Privacy
    • Careers
    Privacy

    Information such as the type of browser being used, its operating system, and your IP address is gathered in order to enhance your online experience.

    © 2013 - 2025 Technotification | All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.