CAT Command
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
Option | Description |
---|---|
-e | $ is printed at the end of each line. This option must be used with -v. |
-s | Suppress messages pertaining to files that do not exist. |
-t | Each tab will display as ^I and each form feed will display as ^L. This option must be used with -v. |
-u | Output is printed as unbuffered. |
-v | Display control characters and nonprinting characters |
Examples
cat file1 cat file1 file2 > all cat file1 >> file2
* Please note that there are many flavors of UNIX, so if in doubt, consult your man pages.
CD Command
The syntax for the cd command is:
cd [dir]
Examples
cd tech cd /tech
CHMOD Command
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
Option | Description |
---|---|
-R | Descend directory arguments recursively while setting modes. |
-f | Suppress error messages if command fails. |
Mode
Mode | Description |
---|---|
Who | u=user, g=group, o=other, a=all (default) |
Opcode | + means add permission - means remove permission = means assign permission and remove the permission of unspecified fields |
Permission | r=Read, w=write, x=Execute, s=set uid bit, t=sticky bit u=user, g=group, o=other, l=mandatory locking |
Examples
chmod 751 tech chmod u=rwx, g=rx, o=x tech chmod =r tech
FTP Command
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
Option | Description |
---|---|
-d | Debugging is enabled. |
-g | Filename globbing is disabled. |
-i | Interactive prompting is disabled. |
-n | When you are initially connecting, auto-login is disabled. |
-v | Display all responses from the server. |
Examples
ftp tech ftp -v tech
GREP Command
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
Option | Description |
---|---|
-b | Display the block number at the beginning of each line. |
-c | Display the number of matched lines. |
-h | Display the matched lines, but do not display the filenames. |
-i | Ignore case sensitivity. |
-l | Display the filenames, but do not display the matched lines. |
-n | Display the matched lines and their line numbers. |
-s | Silent mode. |
-v | Display all lines that do NOT match. |
-w | Match whole word. |
Examples
grep -c tech file1
KILL Command
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
Option | Description |
---|---|
-l | Lists the signal names. |
-signal | The signal number of name. Using the signal number of 9, means that the kill is absolute. |
Examples
kill -9 78689
LS Command
The ls command lists all files in the directory that match the name. If name is left blank, it will list all of the files in the directory.
The syntax for the ls command is:
ls [options] [names]
Options
Option | Description |
---|---|
-a | Displays all files. |
-b | Displays nonprinting characters in octal. |
-c | Displays files by file timestamp. |
-C | Displays files in a columnar format (default) |
-d | Displays only directories. |
-f | Interprets each name as a directory, not a file. |
-F | Flags filenames. |
-g | Displays the long format listing, but exclude the owner name. |
-i | Displays the inode for each file. |
-l | Displays the long format listing. |
-L | Displays the file or directory referenced by a symbolic link. |
-m | Displays the names as a comma-separated list. |
-n | Displays the long format listing, with GID and UID numbers. |
-o | Displays the long format listing, but excludes group name. |
-p | Displays directories with / |
-q | Displays all nonprinting characters as ? |
-r | Displays files in reverse order. |
-R | Displays subdirectories as well. |
-t | Displays newest files first. (based on timestamp) |
-u | Displays files by the file access time. |
-x | Displays files as rows across the screen. |
-1 | Displays each entry on a line. |
Examples
ls -la
MAN Command
The man command displays the online manual pages.
The syntax for the man command is:
man [options] [ [section] subjects]
Options
Option | Description |
---|---|
- | Output is piped through the more command. |
-d | Debug. |
-F | Search the MANPATH directories. |
-f files | Display a summary (one line) for each file. |
-k keywords | Displays the header lines that contain any of the keywords. |
-M path | Searchs in the path instead of the MANPATH directories. |
-t | Format the pages with troff. |
-T mac | Display using mac. |
Examples
man -f tech
MKDIR Command
The mkdir command creates a single directories or multiple directories.
The syntax for the mkdir command is:
mkdir [options] directories
Options
Option | Description |
---|---|
-m mode | Sets the access mode for the new directory. |
-p | If the parent directories don't exist, this command creates them. |
Examples
mkdir -m 444 tech mkdir -p tech/net/faqs
MORE Command
The more command displays the file called name in the screen. The RETURN key displays the next line of the file. The spacebar displays the next screen of the file.
The syntax for the more command is:
more [options] [files]
Options
Option | Description |
---|---|
-c | Page through the file by clearing the window. (not scrolling). |
-d | Displays "Press space to continue, 'q' to quit" |
-f | Count logical lines rather than screen lines (wrapping text) |
-l | Ignores form feed (^L) characters. |
-r | Display all control characters. |
-s | Displays multiple blank lines as one blank line. |
-u | Does not display underline characters and backspace (^H). |
-w | Waits for a user to press a key before exiting. |
-n | Displays n lines per window. |
+num | Displays the file starting at line number num. |
+/pattern | Displays the file starting at two lines before the pattern. |
Examples
more -d tech
MV Command
The syntax for the mv command is:
mv [options] sources target
Options
Option | Description |
---|---|
-f | Forces the move. |
-i | Prompt for a confirmation before overwriting any files. |
Examples
mv -f tech /usr
PASSWD Command
The passwd command changes the password for the user.
The syntax for the passwd command is:
passwd [options] [user]
Options
Option | Description |
---|---|
-s | Displays password information. |
Examples
passwd tech
PS Command
The ps command displays active processes.
The syntax for the ps command is:
ps [options]
Options
Option | Description |
---|---|
-a | Displays all processes on a terminal, with the exception of group leaders. |
-c | Displays scheduler data. |
-d | Displays all processes with the exception of session leaders. |
-e | Displays all processes. |
-f | Displays a full listing. |
-glist | Displays data for the list of group leader IDs. |
-j | Displays the process group ID and session ID. |
-l | Displays a long listing |
-plist | Displays data for the list of process IDs. |
-slist | Displays data for the list of session leader IDs. |
-tlist | Displays data for the list of terminals. |
-ulist | Displays data for the list of usernames. |
Examples
ps -ef ps -aux
PWD Command
The pwd command displays the full pathname of the current directory.
The syntax for the pwd command is:
pwd
SU Command
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
Option | Description |
---|---|
- | Complete the entire login sequence. |
Examples
su root su tech
TAIL Command
The tail command displays the last ten lines of the file.
The syntax for the tail command is:
tail [options] [file]
Options
Option | Description |
---|---|
-f | Follow the file as it grows. |
-r | Displays the lines in the reverse order. |
-n[k] | Displays the file at the nth item from the end of the file. |
+n[k] | Displays the file at the nth item from the beginning of the file. |
Examples
tail -r tech
TELNET Command
The telnet command allows you to communicate to another host using the TELNET protocol.
The syntax for the telnet command is:
telnet [host [port]]
VI Command
The vi command launches the text editor called vi.
The syntax for the vi command is:
vi [options] [files]
Options
Option | Description |
---|---|
-ccommand | Launch vi and execute the command in vi. |
-l | Edit a LISP file. |
-L | Lists all files that were saved due to an editor or system crash. |
-rfile | Recover and open file after an editor or system crash. |
-R | Read-only. |
+ | Position on last line of file in vi. |
+n | Position on n line of the file in vi. |
Examples
vi + tech
WHOAMI Command
The syntax for the whoami command is:
whoami
WHOIS Command
The whois command searches for the person, login, handle, or organization called name.
The syntax for the whois command is:
whois [option] name
Options
Option | Description |
---|---|
-h host | Searches on host name called host. |
Examples
whois tech