140 likes | 364 Vues
UNIX. find command. The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria Syntax: find where-to-lookup criteria/filename Wild cards: find /tmp fi*. find command.
E N D
find command The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria Syntax: find where-to-lookup criteria/filename Wild cards: find /tmp fi*
find command We can use this command to find out files which were modified in last 10 minutes find . -mmin -10 The above lists all the files in current directory which were modified 10 minutes back find . -mtime 0 # find files modified between now and 1 day ago # (i.e., within the past 24 hours) find . -mtime -1 # find files modified less than 1 day ago
find command find . -name '*' -size +1M In the above example the system would search for any file that is larger then 1MB. find . will display the path names of all files in the current directory and all sub directories.
Processes A process is a program in execution. Every time you invoke a system utility or an application program from a shell, one or more "child" processes are created by the shell in response to your command. All UNIX processes are identified by a unique process identifier or PID. We have one command to display current running processes ps Options:ps -all ps -ef
kill command kill command is used to terminate a running process kill -9 PID PID:Process ID
wc command wc command is used to count how many lines, words, and characters there are in a file syntax :wc filename
tar command Create Tape ARchives (TAR) and add or extract files. Options: tar [options] filename.tar filename Creating a tar file: tar -cvf file.tar file Extracting the files from a tar file: tar -xvf file.tar
Compress a file/directory tar -zcvf archive-name.tar.gz directory-name Where, -z: Compress archive using gzip program -c: Create archive -v: Verbose i.e display progress while creating archive -f: Archive File name tar -zxvfarchive-name.tar.gz -x :Extract files
gzip command gzip reduces the size of the files To compress a file with gzip, pass the filename as an argument: gzip file.txt To uncompress, use gunzip: gunzip file.txt.gz or gzip -d file.txt.gz
grep command The grep command allows you to search one file or multiple files for lines that contain a pattern. Grep “string” filename If any match found it displays “string”. If not it wont display any thing Case insensitive search using grep -i Syntax: grep -i "string" FILE
uname uname:command is used display operating system information it gives name,version and 32 bit/64bit of the operating system x86_64 when it is an kernel 64 bits i686 for 32 bits kernel