About Commands
File System Commands
cat
cat is a standard Unix utility that reads files sequentially, writing them to standard output. The name is derived from its function to (con)catenate
files
chattr
chattr allows a user to set certain attributes of a file. lsattr
is the command that displays the attributes of a file.
chmod
chmod - change mode
is the command and system call used to change the access permissions and the special mode flags (the setuid, setgid, and sticky flags) of file system objects (files and directories).
chown
chown - change owner
is used to change the owner of file system files, directories. Unprivileged (regular) users who wish to change the group membership of a file that they own may use chgrp.
cksum
cksum generates a checksum
value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input if no arguments are provided, and outputs the file's 32-bit cyclic redundancy check
(CRC) checksum and byte count. The CRC output by cksum is different from the CRC-32 used in zip, PNG and zlib.
dd
dd command, the primary purpose of which is to convert and copy files.
du
du, disk usage
is used to estimate file space usage — space used under a particular directory or files on a file system.
df
df, disk free
is used to display the amount of available disk space for file systems on which the invoking user has appropriate read access. df is typically implemented using the statfs
or statvfs
system calls.
file
file is for recognizing the type of data contained in a computer file. It can even tell you the uncompressed byte size of a gzipped file.
fuser
fuser is used to show which processes are using a specified computer file, file system, or Unix socket. The command displays the process identifiers (PIDs) of processes using the specified files or file systems. In the default display mode, each PID is followed by a letter denoting the type of access.
ln
ln is used to create a hard link or a symbolic link (symlink
) to an existing file or directory. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk. On the other hand, symbolic links are special files that refer to other files by name.
ls
ls is used to list computer files and directories in Unix and Unix-like operating systems.
pax
pax is an archiving utility available for various operating systems. Rather than sort out the incompatible options that have crept up between tar and cpio, along with their implementations across various versions of Unix, the IEEE designed new archive utility pax that could support various archive formats with useful options from both archivers. The new pax format which is basically tar with additional extended attributes.
split
split is most commonly used to split a computer file into two or more smaller files.
touch
touch is used to update the access date and/or modification date of a computer file or directory.
type
type is a command that describes how its arguments would be interpreted if used as command names. Where applicable, type will display the command name's path. Possible command types are:
- shell built-in
- function
- alias
- hashed command
- keyword
Process Commands
at
at is used to schedule commands to be executed once, at a particular time in the future. It differs from cron, which is used for recurring executions.
bg
bg - The POSIX standard specifies two commands for resuming suspended jobs in the background and foreground, respectively bg
and fg
.
cron
cron is a job scheduler used to run job(s) periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration.
kill
kill is used to send signals to running processes. By default, the message sent is the termination signal, which requests that the process exit. Sometimes the signal sent may have nothing to do with process killing.
lsof
lsof is a command meaning "list open files
", which is used in many Unix-like systems to report a list of all open files and the processes that opened them.
ps
The ps program (short for "process status
") displays the currently-running processes. A related Unix utility named top
provides a real-time view of the running processes.
time
time is used to determine the duration of execution of a particular command.
top
top (table of processes
) is a task manager program, found in many Unix-like operating systems, that displays information about CPU and memory utilization.
Search Commands
find
find is a command-line utility that locates files based on some user-specified criteria and either prints the pathname of each matched object or, if another action is requested, performs that action on each matched object.
grep
grep is a command-line utility for searching plain-text data sets for lines that match a regular expression.
Shell builtin Commands
alias
alias enables a replacement of a word by another string. It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command.
test
test evaluates conditional expressions.
wait
wait pauses until execution of a background process has ended.
Software Development Commands
ctags
ctags is a programming tool that generates an index (or tag) file of names found in source and header files of various programming languages to aid code comprehension.
make
make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program. Make can be used to manage any project where some files need to be updated automatically from others whenever the others change in addition to building programs.
strip
strip program removes information from executable binary programs and object files that is not essential or required for normal and correct execution, thus potentially resulting in better performance and sometimes significantly less disk space usage. The resulting file is a stripped binary.
Text Processing Commands
awk
awk is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter.
csplit
csplit is a utility that is used to split a file into two or more smaller files determined by context lines. The patterns may be line numbers or regular expressions.
The split command also splits a file into pieces, except that all the pieces are of a fixed size (measured in lines or bytes).
cut
cut is used to extract sections from each line of input — usually from a file.
diff
diff is a data comparison tool that computes and displays the differences between the contents of files. Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented, but it is like Levenshtein distance in that it tries to determine the smallest set of deletions and insertions to create one file from the other. The utility displays the changes in one of several standard formats, such that both humans or computers can parse the changes, and use them for patching.
The operation of diff is based on solving the longest common subsequence problem.
fold
fold is used for making a file with long lines more readable on a limited width computer terminal by performing a line wrap.
head
head is used to display the beginning of a text file or piped data.
iconv
iconv, internationalization conversion
is used to convert between different character encodings. It can convert from any of the encodings to any other, through Unicode conversion
.
more
more is a command to view (but not modify) the contents of a text file one screen at a time. Programs of this sort are called pagers. more is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement.
nl
nl is a Unix utility for numbering lines
, either from a file or from standard input, reproducing output on standard output.
sed
sed, stream editor
is a Unix utility that parses and transforms text, using a simple, compact programming language.
sort
sort prints the lines of its input or concatenation of all files listed in its argument list in sorted order. Sorting is done based on one or more sort keys extracted from each line of input. By default, the entire input is taken as sort key. Blank space is the default field separator. The command supports a number of command-line options that can vary by implementation.
strings
strings finds and prints text strings embedded in binary files such as executables. It can be used on object files and core dumps.
tail
tail is used to display the tail end of a text file or piped data.
uniq
uniq is a utility command, when fed a text file or standard input, outputs the text with adjacent identical lines collapsed to one, unique line of text. The command is a kind of filter program. Typically it is used after sort. It can also output only the duplicate lines (with the -d
option), or add the number of occurrences of each line (with the -c
option).
wc
wc, word count
generates one or more of the following statistics: newline count, word count, and byte count. If a list of files is provided, both individual file and total statistics follow.
xargs
xargs, extended arguments
command is used to build and execute commands from standard input. It converts input from standard input into arguments to a command.
User Environment Commands
env
env is used to either print a list of environment variables or run another utility in an altered environment without having to modify the currently existing environment. Using env, variables may be added or removed, and existing variables may be changed by assigning new values to them.
exit
exit causes the shell or program to terminate. If performed within an interactive command shell, the user is logged out of their current session, and/or user's current console or terminal connection is disconnected. Typically an optional exit code can be specified, which is typically a simple integer value that is then returned to the parent process.
uname
uname prints the name, version and other details about the current machine and the operating system running on it.
who
who displays a list of users who are currently logged into the computer.