Skip to main content

Ubuntu Most Used Terminal Commands

 

Command Name & Description

 

Command(s)

 

Sample Output

Date 

The simple “date” command displays the current date and time (including the day of the week, month, time, time zone, year).

date
tim@tim-Nitro-N50-620:~$ date
Thu Mar  2 07:23:38 PM EST 2023

Date TZ

By default, “date” command uses the time zone defined in path “/etc/localtime”. Linux user can change the time zone via Terminal by using command “TZ”.

 

Date --set

Linux allows its user to set the current date and time of the system manually.
Syntax: date –set=”Date_in_format(YYMMDD) Time_in_format(HH:MM)”

 

Date -d

To operate the system on a specific date, you can change the date by using “-d”.
Syntax: date -d Date_to_operate_system_on

date
TZ=GMT date

TZ=America/New_York date
sudo date --set="20230519 22:10"
date -d now
date -d yesterday
date -d tomorrow
date -d last-Sunday
date -d "1997-04-22"
tim@tim-Nitro-N50-620:~$ date
Thu Mar  2 07:23:38 PM EST 2023
$ TZ=GMT date
Fri Mar  3 12:03:59 AM GMT 2023
tim@tim-Nitro-N50-620:~$ TZ=America/New_York date
Thu Mar  2 07:04:12 PM EST 2023
$ date -d now
Thu Mar  2 07:36:55 PM EST 2023
$ date -d yesterday
Wed Mar  1 07:37:00 PM EST 2023

 

 DF

The command “df” shows the amount of disk space used and disk space available on every file system containing each filesystem’s name and its path.
Syntax: df

 

The command “df -h” shows the same result as the command “df” but now the data is in a more human-readable form that can be easily comprehended by a new user.
Syntax: df -h


 
df
df -h

 
$ df
Filesystem                  1K-blocks       Used  Available Use% Mounted on
tmpfs                         1623284       3612    1619672   1% /run
/dev/nvme0n1p3              491343600   18123184  452739188   4% /
tmpfs                         8116400     104604    8011796   2% /dev/shm
tmpfs                            5120          4       5116   1% /run/lock
tmpfs                         8116400          0    8116400   0% /run/qemu
/dev/nvme0n1p2                 456036     182424     239424  44% /boot
/dev/nvme0n1p1                  98304      57271      41033  59% /boot/efi
/dev/sda1                    47744748      57156   45229840   1% /tmp
/dev/sda3                  2787016696 1123163768 1531975216  43% /home
/dev/sda2                    47745772   31301948   13986020  70% /var
192.168.1.1:/media/TR-004 11627352064 9633692672 1407599616  88% /media/tim/TR-004
192.168.1.1:/ubuntu-data    959776768  657463296  253486080  73% /media/tim/ubuntu01-data
192.168.1.11:/home/tim      479593984   21986816  433171968   5% /media/hass-srv
tmpfs                         1623280        288    1622992   1% /run/user/1000
$ df -h
Filesystem                 Size  Used Avail Use% Mounted on
tmpfs                      1.6G  3.6M  1.6G   1% /run
/dev/nvme0n1p3             469G   18G  432G   4% /
tmpfs                      7.8G  103M  7.7G   2% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
tmpfs                      7.8G     0  7.8G   0% /run/qemu
/dev/nvme0n1p2             446M  179M  234M  44% /boot
/dev/nvme0n1p1              96M   56M   41M  59% /boot/efi
/dev/sda1                   46G   56M   44G   1% /tmp
/dev/sda3                  2.6T  1.1T  1.5T  43% /home
/dev/sda2                   46G   30G   14G  70% /var
192.168.1.1:/media/TR-004   11T  9.0T  1.4T  88% /media/tim/TR-004
192.168.1.1:/ubuntu-data   916G  628G  242G  73% /media/tim/ubuntu01-data
192.168.1.11:/home/tim     458G   21G  414G   5% /media/hass-srv
tmpfs                      1.6G  288K  1.6G   1% /run/user/1000

Free

The command “free” displays the amount of free and used memory in the complete system.
Syntax: free

 


free

$ free
               total        used        free      shared  buff/cache   available
Mem:        16232804    10545772      978552      125388     4708480     5252532
Swap:        2097152     2090408        6744