Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Give some Examples for the following commands and what you use it for ?

dd , tune2fs ,fdisk , fsck , sudo su , gksudo , chmod ,chown , mount please if you Know a good and important commands that you deal with ,write it with examples

user-image
Question added by Deleted user
Date Posted: 2014/03/22
Kamal Kamal
by Kamal Kamal , Senior Linux Administrator , Sapient

Hi Hesham,

 

I have tried to give the precise information about the question, please let me know for any other information:

 

 

dd if=/dev/zero of=/data/testfile count=2 bs=128K (It will create a blank file of128K X2 =256K that can be used to increase or add swap size.)

 

tune2fs -c80 /dev/sdb1 (to run fsck after80 mounts)

tune2fs -i d2 m1 w2 /dev/sdb1 (fsck will run after2 days,1 months and2 week)

fdisk –l (to list all hardisk and its partitions)

fdisk /dev/sdb (to create , modify or delete the partition for the given disk)

fsck /dev/sdb1 (to check the health of given partition)

sudo su (to switch to the root or super user account)

gksudo (similar as sudo but its used in GUI while sudo can be use in GUI+CLI both)

chmod g+wr filename (it is used to change permission to any file or directory, here its giving read and write permission to group of the file.)

chown root:root filename (it is used to change the owner and group of any file or directory.)

mount /dev/sdb1 /newpart (it is used to mount the partition(/dev/sdb1) to the mount point (/newpart))

 

Thanks,

Kamal

Gul Zaman
by Gul Zaman , Network Administration , vision technologies

chown root:root filename (it is used to change the owner and group of any file or directory.)

mount /dev/sdb1 /newpart (it is used to mount the partition(/dev/sdb1) to the mount point (/newpart))

dd if=/dev/zero of=/data/testfile count=2 bs=128K (It will create a blank file of128K X2 =256K that can be used to increase or add swap size.)

 

tune2fs -c80 /dev/sdb1 (to run fsck after80 mounts)

tune2fs -i d2 m1 w2 /dev/sdb1 (fsck will run after2 days,1 months and2 week)

fdisk –l (to list all hardisk and its partitions)

fdisk /dev/sdb (to create , modify or delete the partition for the given disk)

fsck /dev/sdb1 (to check the health of given partition)

sudo su (to switch to the root or super user account)

gksudo (similar as sudo but its used in GUI while sudo can be use in GUI+CLI both)

chmod g+wr filename (it is used to change permission to any file or directory, here its giving read and write permission to group of the file.)

 

Muntasir Billah
by Muntasir Billah , Support Engineer , 3Net Technology

chmod>[~]# chmod g+w mahi text  (change the mood mahi give the permission to read ''text' named filed for read and write')

chown>[~]# chown mahi+it text (change the ownership)

mount>[~]# mount /dev/sr0 /mnt  (mounting the file from dvdrom to mnt folder)

sudo su>[~]sudo su kamal ( superuser as Kamal)

Vijai Ganapathy
by Vijai Ganapathy , IT Architect , Hewlett-Packard Enterprise

dd - take dump if hdd image before doing anything on that. 

 

For example, if you have a Harddrive in which you want to undelete some files which were deleted, you first put it in linux environment and assuming the drive is sdb, first I would do 

dd if=/dev/sda of=sdb.img bs=4096 conv=notrunc,noerror,sync 

Once the image created, I would run photorec to undelete the files which are present in that disk either VFAT,NTFS, ext3,ext4 Filesystem. 

# photorec sdb.img 

 

---------

tune2fs

For adjusting the reserved block from5% to2% in case filesystem running out of space or the HDD is too huge on space which might need only2% as reserved space, I would to the following. 

 

# tune2fs -m2 /dev/sdb1 

Also converting ext2 fs to ext3 fs I would, 

#tune2fs -j /dev/sdb1 ; assuming you have unmounted the filesystem. 

-------------------

mount 

To mount iso file you can do the following. 

# mount -o loop disk1.iso /mnt/disk 

 

Rest are already listed by other answers. 

 

 

More Questions Like This