#Command to find Operating System in UNIX
$ uname -a
#Additional options supported by uname command can be found as follows
$ man uname
#Command to find a file(say XYZ.txt) under current directory
$ find . -name "XYZ*" --this will list path of all files starting with XYZ under current directory
$ find . -name "XYZ.txt" --this will list path of file XYZ.txt under current directory
#Command to list contents of directory
$ ls --this will list file and directory names under current directory
$ ls -ltr --this will list details of files and directories under current directory
$ ls -ltr *ABC* --this will list contents of directory with filename like ABC
#Command to search for string in a directory or particular file
$ grep 'test' filename.txt --searches for string 'test' in filename.txt
$ cat filename.txt | grep -i 'test' --searches for string 'test' in filename.txt
$ grep -i 'test' filename.txt --ignores case of string 'test' (TEST, test, Test, etc) while searching
$ grep -r 'test' ./migration --searches for string 'test' recursively in migration directory
$ grep -l 'test' *.ldt --list all .ldt files, where 'test' appears
No comments:
Post a Comment