Linux CLI Commands

UNICS (UNiplexed Information Computing System), Unix, Unix Ware, SCO Unix, BSD, Free BSD, Net BSD, DragonFly BSD, System III, System V, Minix, Xenix, SCO-Xenix, POSIX, HP-UX, AIX, Solaris, Open Solaris, Sun OS, NexTStep / OPENSTEP, GNU, Linux, (Kali, Debian, Android, Scientific Linux, Fedora, CentOS, Mandrake, SUSE[Gecko, Studio], UBUNTU [Gubuntu, Lubuntu, Edubuntu, Mythbuntu, Ubuntu GNOME, Ubuntu MATE], Red Hat, Arch Linux, Bodhi Linux), Open Server, IRIX, Mac OS, OS X etc …

There are so many Unix and Unix like systems so far. Check out https://commons.wikimedia.org/wiki/File:Unix_timeline.en.svg and https://upload.wikimedia.org/wikipedia/commons/7/77/Unix_history-simple.svg for comprehensive beautiful charts.

Linux is open source, community driven & portable unlike Unix and it has more flavors, better GUI, larger number of users, faster Bug-Fix-Support, lesser viruses, supports more file systems compared to all that of Unix which makes Linux more popular.

FYI all the CLI (Command Line Interface) commands below are tried & tested successfully on Ubuntu 20.04.2 LTS. Some of them may or may not work on different systems. In that case, getting a distro (free distribution from online community) or installing certain command access via sudo (Super User) might help. Happy Linux-ing!


Version related Linux commands

Checking Version: cat simply displays the content of any file. Here, os-release file holds the Version data.

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Network / Internet related Linux commands

Fetching server detail online: Tells server name of your website. curl is cURL You are piping (|) the command output into a command line utility called grep which filters out given pattern (‘erver’) for you and prints entire line. (server: nginx). GREP stands for Global Regular Expression Print. Regular Expression ‘erver’ works better because sometimes it fetches “S” of Server and not small “s”. We don’t want command to fail in any circumstances.

$ curl -Is https://wordpress.com | grep 'erver'
server: nginx

$ curl -I -s https://janiplastics.com | grep 'erver'
server: Apache

$ curl -sI https://lansdalelibrary.org | grep 'erver'
Server: Apache/2.4.41 (Ubuntu)

Checking connectivity: Pinging the nodes to check the network connectivity. Press Ctrl + C to stop pinging & break the cycle.

$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.043 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.033 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.041 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.042 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.042 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.044 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.043 ms
^C
--- 127.0.0.1 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7155ms
rtt min/avg/max/mdev = 0.033/0.041/0.044/0.003 ms

$ ping 127.0.1.1
PING 127.0.1.1 (127.0.1.1) 56(84) bytes of data.
64 bytes from 127.0.1.1: icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from 127.0.1.1: icmp_seq=2 ttl=64 time=0.043 ms
64 bytes from 127.0.1.1: icmp_seq=3 ttl=64 time=0.045 ms
64 bytes from 127.0.1.1: icmp_seq=4 ttl=64 time=0.042 ms
^C
--- 127.0.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3071ms
rtt min/avg/max/mdev = 0.040/0.042/0.045/0.002 ms

Website Record: Gives you entire record of any website including who is registrar, what is expiry date, what was creation date, etc…

$ whois janisoftwares.in
Domain Name: janisoftwares.in
Registry Domain ID: D414400000006614793-IN
Registrar WHOIS Server:
Registrar URL: www.godaddy.com
Updated Date: 2020-08-09T15:37:43Z
Creation Date: 2018-09-03T18:27:07Z
Registry Expiry Date: 2025-09-03T18:27:07Z
Registrar: GoDaddy.com, LLC
......
......
......

File related Linux commands

Getting file size data : Lists bytes, characters, lines, max line length, words (and the total in the end) of all the files present in the current working directory.

$ wc -cmlLw *
 0  0  0  0  0 myCurl
 3 12 57 57 30 myCurl.sh
 3 12 57 57 30 total

Environment related Linux commands

$ env
SHELL=/bin/bash
SESSION_MANAGER=local/MATRIX:@/tmp/.ICE-unix/1420,unix/MATRIX:/tmp/.ICE-unix/1420
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu-wayland:/etc/xdg
SSH_AGENT_LAUNCHER=gnome-keyring
XDG_MENU_PREFIX=gnome-
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LANGUAGE=en_AU:en
LC_ADDRESS=en_IN
GNOME_SHELL_SESSION_MODE=ubuntu
LC_NAME=en_IN
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XMODIFIERS=@im=ibus
DESKTOP_SESSION=ubuntu-wayland
LC_MONETARY=en_IN
GTK_MODULES=gail:atk-bridge
PWD=/home/neo
LOGNAME=neo
XDG_SESSION_DESKTOP=ubuntu-wayland
XDG_SESSION_TYPE=wayland
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.DDRQ70
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
HOME=/home/neo
USERNAME=neo
IM_CONFIG_PHASE=1
LC_PAPER=en_IN
LANG=en_AU.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=ubuntu:GNOME
VTE_VERSION=6003
WAYLAND_DISPLAY=wayland-0
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/972cc580_3b7b_488b_81d3_bb68f7b0d078
INVOCATION_ID=2c9c583f0b394a2485290ec02f1879bc
MANAGERPID=1277
GJS_DEBUG_OUTPUT=stderr
GNOME_SETUP_DISPLAY=:1
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=xterm-256color
LC_IDENTIFICATION=en_IN
LESSOPEN=| /usr/bin/lesspipe %s
USER=neo
GNOME_TERMINAL_SERVICE=:1.115
DISPLAY=:0
SHLVL=1
LC_TELEPHONE=en_IN
QT_IM_MODULE=ibus
LC_MEASUREMENT=en_IN
PAPERSIZE=a4
XDG_RUNTIME_DIR=/run/user/1000
LC_TIME=en_IN
JOURNAL_STREAM=8:38059
XDG_DATA_DIRS=/usr/share/ubuntu-wayland:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
GDMSESSION=ubuntu-wayland
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
LC_NUMERIC=en_IN
_=/usr/bin/env

Super User (sudo) related Administrative Linux commands

Installing the Commands: You often get to see other Linux users accessing some commands which are not there on your Terminal. How to install those? Below is htop Command installed using “sudo snap install”. The sudo is Super User Do. It gives you access for installing new Commands.

$ htop
Command 'htop' not found, but can be installed with:

sudo snap install htop  # version 3.0.5, or
sudo apt  install htop  # version 2.2.0-2build1

See 'snap info htop' for additional versions.

$ sudo snap install htop
[sudo] password for neo: 
htop 3.0.5 from Maximiliano Bertacchini (maxiberta) installed

Update the Packages: the above (sudo snap install) is not about installing packages. For handling (installing / updating / upgrading / uninstalling) packages we use commands of apt (Advanced Packaging Tool). REMEMBER: You must update before upgrade. So here is the update command of apt. It synchronizes the package index files from source. Updates the list of available packages.

IF YOU RUN WITHOUT sudo PERMISSION, YOU GET OUTPUT SOMETHING LIKE THIS.
$ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

SO LET'S RUN USING sudo AND SEE THE DIFFERENCE FOR YOURSELF.
sudo apt-get update
[sudo] password for neo: 
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease        
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]  
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [27.6 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [60.7 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,468 B]
Fetched 205 kB in 3s (67.7 kB/s)           
Reading package lists... Done

Dependency Verification: Check the packages for broken dependencies.

$ sudo apt-get check
[sudo] password for neo: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done

Cleaning up old archives: We often keep on downloading new things without realizing how much old junk we have accumulated that is unused. Following command helps you rrases old downloaded archive files.

$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Del systemd-timesyncd 245.4-4ubuntu3.7 [28.1 kB]
Del systemd 245.4-4ubuntu3.7 [3,806 kB]
Del libudev1 245.4-4ubuntu3.7 [77.6 kB]
Del ubuntu-release-upgrader-gtk 1:20.04.33 [9,360 B]
Del udev 245.4-4ubuntu3.7 [1,366 kB]
Del ubuntu-release-upgrader-core 1:20.04.33 [23.8 kB]
Del systemd-sysv 245.4-4ubuntu3.7 [10.3 kB]
Del libsystemd0 245.4-4ubuntu3.7 [270 kB]
Del libpam-systemd 245.4-4ubuntu3.7 [186 kB]
Del ubuntu-advantage-tools 27.1~20.04.1 [837 kB]
Del python3-distupgrade 1:20.04.33 [104 kB]
Del libnss-systemd 245.4-4ubuntu3.7 [96.1 kB]

Process related Linux commands

Process Status:

$ ps
    PID TTY          TIME CMD
   6799 pts/2    00:00:00 bash
   8870 pts/2    00:00:00 ps

Linux Task Manager: This command is like Task Manager in MS-Windows. Shows all current ongoing processes with Process IDs, Priorities, User Names, Memory status, CPU usage, etc…

$ top
Linux Task Manager

Interactive Task Manager on Linux: htop provides you an User Interface for viewing, sorting, searching and killing the processes. You can directly send the status code to the process from here. e.g. Select a process, Press F9 to kill it.

$ htop
User Interface on Linux for Task Manager
Viewing the Linux Processes priority wise.
TREE View of Processes

Memory related Linux commands

Expert’s advice: Though it is possible to carry out fine tunning of RAM (e.g. defragment). Copying huge data on RAM and put it on SWAP and then defragment. However, it is not a good idea because the data duplication or redundancy may be shared by other applications. Defragmentation removes those and this can make your system unstable.

In fact, Unix like systems such as Linux never requires a patch-up utility like Defragment. Microsoft gave that to fix its own error [as per some experts].

RAM on your Linux: How much memory is free, how much is used up.

$ cat /proc/meminfo
MemTotal:        4027472 kB
MemFree:         1051932 kB
MemAvailable:    2246136 kB
Buffers:           71540 kB
Cached:          1333848 kB
SwapCached:            0 kB
Active:           530428 kB
Inactive:        2104344 kB
Active(anon):       1968 kB
Inactive(anon):  1275516 kB
Active(file):     528460 kB
Inactive(file):   828828 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2097148 kB
SwapFree:        2097148 kB
Dirty:               272 kB
Writeback:             0 kB
AnonPages:       1229372 kB
Mapped:           454188 kB
Shmem:             48104 kB
KReclaimable:      83680 kB
Slab:             146508 kB
SReclaimable:      83680 kB
SUnreclaim:        62828 kB
KernelStack:        9920 kB
PageTables:        19868 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4110884 kB
Committed_AS:    4770612 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       25052 kB
VmallocChunk:          0 kB
Percpu:             3056 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      194304 kB
DirectMap2M:     3999744 kB
IN BYTES 
$ free
              total        used        free      shared  buff/cache   available
Mem:        4029484     1780392      460692       42208     1788400     1948380
Swap:       2097148       33080     2064068


IN GIGA BYTES (HUMAN READABLE).
$ free -h
              total        used        free      shared  buff/cache   available
Mem:          3.8Gi       1.8Gi       354Mi        39Mi       1.7Gi       1.8Gi
Swap:         2.0Gi        32Mi       2.0Gi

Statistical Reports on Virtual Memory with various outputs due to various options.

THE SWAP MEMORY STATUS CAN BE SEEN HERE.
$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0 599312 139036  24204 452632    2   15    61    57  160  539 15  4 79  1  0
SLAB WISE INFO.
$ vmstat -s
      4029484 K total memory
      3467948 K used memory
      2925428 K active memory
       618996 K inactive memory
       180836 K free memory
        21816 K buffer memory
       358884 K swap cache
      2097148 K total swap
       604472 K used swap
      1492676 K free swap
       660315 non-nice user cpu ticks
         1112 nice user cpu ticks
       186259 system cpu ticks
      3432216 idle cpu ticks
        55684 IO-wait cpu ticks
            0 IRQ cpu ticks
         1364 softirq cpu ticks
            0 stolen cpu ticks
      2629086 pages paged in
      2487977 pages paged out
        25440 pages swapped in
       168083 pages swapped out
     94131691 interrupts
    197966757 CPU context switches
   1627633057 boot time
         8209 forks
SUMMARY OF THE (HARD) DISK STATISTICS.
$ vmstat -D
           20 disks 
            3 partitions 
        91471 total reads
        34330 merged reads
      5260882 read sectors
       752765 milli reading
        84432 writes
       254299 merged writes
      4989210 written sectors
       342946 milli writing
            0 inprogress IO
          812 milli spent IO
SECTOR WISE DISK STATISTICS.
~$ vmstat -d
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
loop0     54      0    2188    7747      0      0       0       0      0      5
loop1     65      0    2200   15377      0      0       0       0      0      5
loop2     59      0    2140   12733      0      0       0       0      0      5
loop3     69      0    2912   13228      0      0       0       0      0      5
loop4     45      0     708    5316      0      0       0       0      0      4
loop5    451      0   14566    7255      0      0       0       0      0      7
loop6     47      0     718    3811      0      0       0       0      0      2
loop7    521      0   16986    7272      0      0       0       0      0      6
sda    84246  34381 5043130  614670  84631 254535 4996658  343936      0    722
loop8    137      0    8692    3725      0      0       0       0      0      3
loop9     41      0     280    3835      0      0       0       0      0      3
loop10     55      0    2180    5756      0      0       0       0      0      4
loop11   1090      0   26562    9948      0      0       0       0      0      8
loop12     59      0    2146   10984      0      0       0       0      0      3
loop13   1968      0   14500    7512      0      0       0       0      0      5
loop14     45      0     716    4110      0      0       0       0      0      3
loop15   1137      0   26850    6025      0      0       0       0      0      7
loop16     45      0     710    3155      0      0       0       0      0      2
loop17   1306      0   89780   10405      0      0       0       0      0     14
loop18    132      0    4130     307      0      0       0       0      0      0

External device / source related Linux commands.

Everything in Linux is file. Linux has its own file system. File system starts with root “/”. Various items are mounted in various respective folders. e.g. system functions are mounted on /sys. Processes are mounted on /proc, so on and so forth. To see a list of everything mounted, just run “mount” command on command prompt.

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=1984112k,nr_inodes=496028,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=402748k,mode=755,inode64)
/dev/sda5 on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755,inode64)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16626)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/var/lib/snapd/snaps/android-studio_113.snap on /snap/android-studio/113 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/atom_279.snap on /snap/atom/279 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/android-studio_114.snap on /snap/android-studio/114 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/atom_282.snap on /snap/atom/282 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_11420.snap on /snap/core/11420 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_2066.snap on /snap/core18/2066 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_2074.snap on /snap/core18/2074 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1081.snap on /snap/core20/1081 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1026.snap on /snap/core20/1026 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/curl_47.snap on /snap/curl/47 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/curl_233.snap on /snap/curl/233 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-34-1804_66.snap on /snap/gnome-3-34-1804/66 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-34-1804_72.snap on /snap/gnome-3-34-1804/72 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1515.snap on /snap/gtk-common-themes/1515 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1514.snap on /snap/gtk-common-themes/1514 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/htop_2802.snap on /snap/htop/2802 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/intellij-idea-ultimate_311.snap on /snap/intellij-idea-ultimate/311 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_518.snap on /snap/snap-store/518 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_547.snap on /snap/snap-store/547 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_12398.snap on /snap/snapd/12398 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_12704.snap on /snap/snapd/12704 type squashfs (ro,nodev,relatime,x-gdu.hide)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=402744k,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /run/user/1000/doc type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=402748k,mode=755,inode64)
nsfs on /run/snapd/ns/snap-store.mnt type nsfs (rw)

Mount / Unmount: When some external source / devices (such as Pen Drive / Flash drive / External Hard Drive) needs to be accessed by Linux, that source’s file system essentially has to be attached at a particular point (specified directory) in the file system of Linux. Once done, the Linux operating system’s Kernel is instructed about path, label and uuid of this source the device’s files and folders are available and ready to use. The CLI command $ mount attaches, whereas $ umount detaches. Ubuntu VERSION=”20.04.2 LTS (Focal Fossa)” has automatic detection of external HDD. Run $ mount CLI command before and after to see the difference. You will find additional file system mounted in the end.

LISTS ALL FILE SYSTEMS MOUNTED SO FAR. (BEFORE CONNECTING EXTERNAL HDD).
$ mount -l
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=1984120k,nr_inodes=496030,mode=755,inode64)
...
...
...
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=402748k,mode=755,inode64)
nsfs on /run/snapd/ns/snap-store.mnt type nsfs (rw)


LISTS ALL FILE SYSTEMS MOUNTED SO FAR. (AFTER CONNECTING EXTERNAL HDD).
$ mount -l
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=1984120k,nr_inodes=496030,mode=755,inode64)
...
...
...
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=402748k,mode=755,inode64)
nsfs on /run/snapd/ns/snap-store.mnt type nsfs (rw)
/dev/sdb1 on /media/neo/ANUP JANI type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2) [ANUP JANI]

Though Ubuntu 20.04.2 offers auto detection feature of external HDD, some might recommend to unmount it to ensure secure unplugging of external HDD, however the umount command is very dangerous (umount -a removes all file systems from disk) I woul simply unplug without umount.

It’s your call.
VERY HELPFUL COMMAND AND COMMAND OPTION.
$ help
$ <Any #Linux CLI command> --help


Advertisement