The cat command reads one or more files and prints them to standard output. The operator > can be used to combine multiple files into one. The operator >> can be used to append to an existing file. The syntax for the cat command is: cat [options] [files]
options: e s
$ is printed at the end of each line. This option must be used with -v. Suppress messages pertaining to files that do not exist. Each tab will display as ^I and each form feed will display as ^L. This option must be used with -v.
t u v
Output is printed as unbuffered. Display control characters and nonprinting characters
Examples: cat file1 cat file1 file2 > all cat file1 >> file2
The chmod command changes the access mode of one file or multiple files. The syntax for the chmod command is: chmod [option] mode files
options: R f
Descend directory arguments recursively while setting modes. Suppress error messages if command fails.
mode: Who Opcode
u=user, g=group, o=other, a=all (default) + means add permission - means remove permission = means assign permission and remove the permission of unspecified
fields r=Read, w=write, x=Execute, s=set uid bit, t=sticky bit u=user, g=group, o=other, l=mandatory locking
Permissio n Examples:
chmod 751 tech chmod u=rwx, g=rx, o=x tech chmod =r tech
The ftp command allows you to transfer files to and from a remote server. The syntax for the ftp command is: ftp [options] [hostname]
options: d g i n v
Debugging is enabled. Filename globbing is disabled. Interactive prompting is disabled. When you are initially connecting, auto-login is disabled. Display all responses from the server.
Examples: ftp tech ftp -v tech
The grep command allows you to search one file or multiple files for lines that contain a pattern. Exit status is 0 if matches were found, 1 if no matches were found, and 2 if errors occurred. The syntax for the grep command is:
grep [options] pattern [files]
options: b c h i l n s v w
Display the block number at the beginning of each line. Display the number of matched lines. Display the matched lines, but do not display the filenames. Ignore case sensitivity. Display the filenames, but do not display the matched lines. Display the matched lines and their line numbers. Silent mode. Display all lines that do NOT match. Match whole word.
Examples: grep -c tech file1
The kill command allows you to kill one process ID or multiple process IDs. The syntax for the kill command is: kill [options] IDs
options: -l -sig nal
Lists the signal names. The signal number of name. Using the signal number of 9, means that the kill is absolute.
Examples: kill -9 78689
The man command displays the online manual pages. The syntax for the man command is: man [options] [[section] subjects]
options: Output is piped through the more command. Debug. Search the MANPATH directories. Display a summary (one line) for each file. Displays the header lines that contain any of the keywords. Searchs in the path instead of the MANPATH directories. Format the pages with troff. Display using mac.
-d -F -f files -k keywords -M path -t -T mac Examples: man -f tech
The mv command allows you to move and rename files. The syntax for the mv command is: mv [options] sources target
options: f i
Forces the move. Prompt for a confirmation before overwriting any files.
Examples: mv -f tech /usr
The ps command displays active processes. The syntax for the ps command is: ps [options]
options: a c d e -f g li s t -j -l p li s t s li s t t li s t u li s t
Displays all processes on a terminal, with the exception of group leaders. Displays scheduler data. Displays all processes with the exception of session leaders. Displays all processes. Displays a full listing. Displays data for the list of group leader IDs. Displays the process group ID and session ID. Displays a long listing Displays data for the list of process IDs.
Displays data for the list of session leader IDs.
Displays data for the list of terminals.
Displays data for the list of usernames.
Examples: ps -ef ps -aux
The su command creates a shell with the user ID of another user. The syntax for the su command is: su [option] [user] [shell_args]
options: -
Complete the entire login sequence.
Examples: su root su tech
The tail command displays the last ten lines of the file. The syntax for the tail command is: tail [options] [file]
options: -f -r
Follow the file as it grows. Displays the lines in the reverse order. Displays the file at the nth item from the end of the file. Displays the file at the nth item from the beginning of the file.
-n[k] +n[k] Examples: tail -r tech
The vi command launches the text editor called vi. The syntax for the vi command is: vi [options] [files]
options: -ccomma nd -l -L
Launch vi and execute the command in vi. Edit a LISP file. Lists all files that were saved due to an
editor or system crash. Recover and open file after an editor or system crash. Read-only. Position on last line of file in vi. Position on n line of the file in vi.
-rfile -R + +n
The whoami command displays your username. The syntax for the whoami command is: whoami
The whois command searches for the person, login, handle, or organization called name. The syntax for the whois command is: whois [option] name
options: -h ho st
Searches on host name called host.
Examples: whois tech