A Few Handy Linux Commands
I wanted to a share a few Linux commands I found myself using this weekend while moving some data around and extracting some video files from an iso.
The first one is used to mount an iso file in Linux so that you can browse it like any other directory.
You will need root credential for this
First thing we need to is make a directory to mount to:
mkdir -p /mnt/disk
Next we will mount the iso to that location
mount -o loop disk1.iso /mnt/disk
Now move to the directory,
cd /mnt/disk
and list the contents.
ls
The next command we are going to explore is df
The df command is used in this syntac df [OPTION]… [FILE]…
-a, –all include dummy file systems
-B, –block-size=SIZE use SIZE-byte blocks
-h, –human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, –si likewise, but use powers of 1000 not 1024
-i, –inodes list inode information instead of block usage
-k like –block-size=1K
-l, –local limit listing to local file systems
–no-sync do not invoke sync before getting usage info (default)
-P, –portability use the POSIX output format
–sync invoke sync before getting usage info
-t, –type=TYPE limit listing to file systems of type TYPE
-T, –print-type print file system type
-x, –exclude-type=TYPE limit listing to file systems not of type TYPE
–version output version information and exit
df -h
The above command is one of the most commonly used commands as it displays the sizes in an easy to read format as shown in the below example.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 71G 32G 35G 48% /
tmpfs 691M 0 691M 0% /lib/init/rw
varrun 691M 312K 690M 1% /var/run
varlock 691M 0 691M 0% /var/lock
udev 691M 140K 690M 1% /dev
tmpfs 691M 272K 690M 1% /dev/shm
lrm 691M 2.4M 688M 1% /lib/modules/2.6.28-11-generic/volatile
Post a reply