Basic File Navigation:
df command in Linux provides disk space usage information of your file systems.
$ df –h (in human readable format)
[oracle@db-uat trace]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 12K 16G 1% /dev/shm
tmpfs 16G 258M 16G 2% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/OSVG-rootlv 10G 253M 9.8G 3% /
/dev/mapper/OSVG-usrlv 30G 5.4G 25G 18% /usr
/dev/xvda1 2.0G 423M 1.6G 21% /boot
/dev/mapper/OSVG-varlv 10G 2.5G 7.6G 25% /var
/dev/mapper/OSVG-vartmplv 2.0G 47M 2.0G 3% /var/tmp
/dev/mapper/OSVG-homelv 10G 51M 10G 1% /home
/dev/mapper/DATAVG-TmpLV 8.0G 33M 8.0G 1% /tmp
/dev/mapper/DATAVG-UatDB 977G 435G 542G 45% /uatdb
/dev/mapper/OSVG-varloglv 5.0G 264M 4.8G 6% /var/log
/dev/mapper/OSVG-varlogauditlv 5.0G 1.7G 3.3G 35% /var/log/audit
tmpfs 3.2G 72K 3.2G 1% /run/user/1005
[oracle@db-uat trace]$
du command
Display how much disk space is being used by directories.
[oracle@db-uat backup]$ du -ak RMAN
4 RMAN/24AUG22/rman_backup.sh
6163836 RMAN/24AUG22/UAT_20220824_17_1_FULL
11360964 RMAN/24AUG22/UAT_20220824_16_1_FULL
1136 RMAN/24AUG22/UAT_20220824_18_1_FULL
96 RMAN/24AUG22/UAT_20220824_19_1_FULL
868656 RMAN/24AUG22/RMAN_ARCH_UAT_20220824_20_1_0k15utqv.bkp
850596 RMAN/24AUG22/RMAN_ARCH_UAT_20220824_21_1_0l15utqv.bkp
34496 RMAN/24AUG22/UAT_20220824_22_1_CONTROL
19279788 RMAN/24AUG22
19279788 RMAN
-a – Shows counts for all files encountered, not only directories.
-k – Use 1024 byte blocks instead of the default 512.
Basic File Navigation
Head
command prints the first N number of data of the given input. By default, it prints first 10
lines of each given file
tail
Show last lines of a file.
$tail -500 alert.log #Print only the last 500 lines of the alert log file.
man
The Linux command “man” is used at the command line to explain the functions and definitions
of other commands commonly used within Linux. The term “man” is short for manual pages
and gives you a very in-depth explanation of the said command which you are referring to
$ man ls
$ man chown
“pwd” command displays the present working directory.
[oracle@db-uat backup]$ pwd
/uatdb/backup
The “ls” command lists all files and directories in the specified directory. If no location is defined
it acts on the current directory.
[oracle@db-uat ~]$ ls
dead.letter Desktop Documents Downloads Music oradiag_oracle Pictures Public Templates UAT_db-uat.env Videos
[oracle@db-uat ~]$ ls /uatdb
backup DB_BKPnov10.tar.gz oraInventory oraInventorybkk oraInventorybkp oraInventoryBKP08 oraInventoryBKP27 oraInventorybkpnob RMAN script tmp UAT UATbkp
[oracle@db-uat ~]$ ls -al
total 88
drwx—— 18 oracle dba 4096 Aug 25 13:43 .
drwxr-xr-x. 10 root root 4096 Mar 11 2022 ..
-rw——- 1 oracle dba 25914 Sep 14 13:55 .bash_history
-rw-r–r– 1 oracle dba 18 Nov 22 2019 .bash_logout
-rw-r–r– 1 oracle dba 193 Nov 22 2019 .bash_profile
-rw-r–r– 1 oracle dba 231 Nov 22 2019 .bashrc
drwxr-xr-x 12 oracle dba 4096 Oct 10 2021 .cache
drwxr-xr-x 14 oracle dba 4096 Oct 10 2021 .config
drwx—— 3 oracle dba 25 Oct 10 2021 .dbus
-rw——- 1 oracle dba 6 Dec 18 2021 dead.letter
drwxr-x— 2 oracle dba 6 Oct 10 2021 Desktop
drwxr-x— 2 oracle dba 6 Oct 10 2021 Documents
drwxr-x— 2 oracle dba 6 Oct 10 2021 Downloads
-rw——- 1 oracle dba 16 Oct 10 2021 .esd_auth
-rw——- 1 oracle dba 2508 Aug 16 22:58 .ICEauthority
-rw-r–r– 1 oracle dba 172 Apr 1 2020 .kshrc
drwx—— 3 oracle dba 19 Oct 10 2021 .local
drwxr-xr-x 4 oracle dba 39 Oct 5 2021 .mozilla
drwxr-x— 2 oracle dba 6 Oct 10 2021 Music
drwxr-xr-x 3 oracle dba 18 Oct 10 2021 oradiag_oracle
drwxr-x— 2 oracle dba 6 Oct 10 2021 Pictures
drwxr-x— 2 oracle dba 6 Oct 10 2021 Public
drwx—— 2 oracle dba 25 May 18 14:28 .ssh
drwxr-x— 2 oracle dba 6 Oct 10 2021 Templates
lrwxrwxrwx 1 oracle dba 43 Aug 25 11:18 UAT_db-uat.env -> /uatdb/UAT/db/tech_st/12.1.0/UAT_db-uat.env
drwxr-x— 2 oracle dba 6 Oct 10 2021 Videos
-rw——- 1 oracle dba 7153 Aug 25 13:43 .viminfo
drwxr-x— 2 oracle dba 4096 Aug 16 22:58 .vnc
-rw——- 1 oracle dba 500 Aug 16 22:58 .Xauthority
[oracle@db-uat ~]$ ^C
[oracle@db-uat ~]$
$ ls –l or ll (Listing in long format).
The “-a” flag lists hidden “.” files.
The “-l” flag lists file details (Listing in long format).
“cd” command -> change directories.
[oracle@db-uat backup]$ cd 24DEC21
[oracle@db-uat 24DEC21]$ pwd
/uatdb/backup/24DEC21
“touch” -> create a new empty file.
[oracle@db-uat 24DEC21]$ touch example.log
[oracle@db-uat 24DEC21]$ ls
DB_BKP24DEC21.tar.gz example.log