Thursday, June 17, 2021

Unix Commands : Listing the files

 


For listing the files in Unix, we can use the command

ls  -  ls will allow you to list the files and folder in a particualr permissions

For see the files full details like last modfied date , file owner , file groups -lrt can be used

ls -lrt or ls -ltr can used used tol files with file owner ,file group and last modified stamp

For listing the hidden files in Unix the below command -a can used be along with -lrt

ls -lart  - This will all files inlcude hidden files in a directory

To see what are the folders that has extened permissions aprart from file owner and file groups below command can be used.

ls -le  - This will display the directory that has extened permission.

After identifying the extened permission, For updating the group or add extra group

acledit an be used.


acledit directory


head :  used to for get top rows in a file

usage :  head -10 file.txt

The above command will fetch first 10 rows from a file file.txt

tail :  used to for get last rows in a file

usage :  tail -10 file.txt

The above command will fetch last 10 rows from a file file.txt


To check the number of lines wc command will be used

wc -l filename.txt  (filename.txt is the filename we need to check the number of lines)


To list the files with specific text in a folder 


grep -Ril "search keyword"   "filepath"


with two arguments like search keyword and filepath we can find the keyword that is used in all files.



No comments: