Permissions Related
Command
|
Description And Example
|
chmod
|
With help of this we can change the file permissions of a file, which can be assigned permissions to user, group and others
4 - (read), 2 - (write) and 1 - (execute).
chmod 777 filename -- read, write and execute for all
chmod 755 filename --rwx for owner, rw for group and others.
-rwxrw-rw-
First "-" indicates it’s a normal file if first character is "d" then it is a directory, first set or rwx (read, write and execute) belongs to owner, and second set of rwx belongs to group and third set of rwx belongs to others.
|
chown
|
Helps to change the owner and group of the file
$ chown
$ chown kalyan file1 -- It changes the owner of file to kalyan login
How to change the owner and group
$ chown
$ chown kalyan:users file1 -- It changes the owner as "kalyan" and group as "users" for file1
How to change owner to all files in any folder
$ chown -R
$ chown -R Kalyan:Users /usr2/kalyan/jpgs
|
chgrp
|
Helps to change the group of the file, The difference between chown and chgrp is, using chown you can change the owner and group of a file, but using chgrp you can change on the group of the file not the owner
$ chgrp
$ chgrp bin /usr2/kalyan/myfile -- It changes the group of myfile to bin
$ chgrp -R bin /usr2/kalyan/executables/ - It changes the group to bin for all files in the given path
|
Disk Space Related
Command
|
Description And Example
|
df
|
The df command stands for "disk filesystem", It displays how much space is occupied and how much space is available on file systems not directories and files
$ df -- Displays file systems usage statistics when you run without any argument
$ df -h -- Displays in human readable format
$ df -h test -- It displays usage information of the filesystem where test resides, it wont give you size of test directory.
-i- -- Displays inode information instead of block usage
$ df -i. -- Displays inode information instead of block usage
Switches
-a -- Shows all file system disk usage
-k -- Displays output in Kilobytes
-i- --Displays inode information
-t --Displays disk space usage for each of the specified type of file system
-T --Displays file system type
|
du
|
The du command stands for "disk usage", this command will display usage information of a directory and sub-directory and displays the blocks that are occupied.
Switches
-a -- Write counts for all files, not just directories
-h -- Displays output in human readable format
-c -- To get the total usage in the output
-s -- To get only total size in form of summary
$ du -h
$ du -sh
$ du -ahc
$ du -sh --exclude="*.txt" --Exclude the .txt files and provides the size of remaining all files
|
No comments: