alias
Create an alias
Usage | alias [name[=’value’]] |
Example | alias la=’ls -la --color=auto’ |
Explanation | Creates an alias for the ls command which displays a detailed list with various file types in different colours. |
Windows equivalent | N/A |
cat
Display the contents of a file
Usage | cat [options] [file1] [file2] ... |
Example | cat index.html |
Explanation | Displays the contents of the index.html file. |
Windows equivalent | type |
cd
Change directory
Usage | cd [-LP] [directory] |
Example | cd /usr/local/bin |
Explanation | Changes the /usr/local/bin directory. |
Windows equivalent | cd |
chgrp
Change group ownership
Usage | chgrp [options] group file1 file2 ... |
Example | chgrp apache index.html |
Explanation | Changes the group ownership of the index.html file to the apache group. |
Windows equivalent | N/A |
chmod
Change access permissions
Usage | chmod [options] mode file1 file2 ... |
Example | chmod 755 script.cgi |
Explanation | "Changes the permissions of script.cgi so that everyone can execute and read it |
Windows equivalent | but only the owner can write to it." |
chown
Change file owner and group
Usage | chown [options] new-owner file1 file2 ... |
Example | chown root index.html |
Explanation | Changes the ownership of the index.html file to root. |
Windows equivalent | N/A |
cmp
Character-by-character compare between two files
Usage | cmp [options] from-file to-file |
Example | cmp index.html default.htm |
Explanation | "Compares each character in index.html and default.htm |
Windows equivalent | and displays the differences." |
cp
Copy one or more files to another location
Usage | cp [options] source destination |
Example | cp index.html index.html.bak |
Explanation | Makes a second copy of the index.html file in the same directory. The new copy has the BAK extension. |
Windows equivalent | "copy |
df
Display free disk space
Usage | df [options] [file] |
Example | df |
Explanation | Displays the used and free disk space on all mounted filesystems. |
Windows equivalent | dir |
du
Estimate file space usage
Usage | du [options] [file] |
Example | du |
Explanation | Displays the disk usage of the current directory. |
Windows equivalent | dir |
echo
Display message on screen
Usage | echo [options] [string] |
Example | echo Hello World! |
Explanation | Displays the Hello World! message on the screen. |
Windows equivalent | echo |
env
"Display
Usage | set or remove environment variables" |
Example | env [options] [name[=value]] [comand [args]] |
Explanation | env HOME=/home/username |
Windows equivalent | Changes the HOME environment variable to /home/username. |
exit
Exit the shell
Usage | exit |
Example | exit |
Explanation | Exits from the current shell. |
Windows equivalent | N/A |
free
Display memory usage
Usage | free [options] |
Example | free -s 5 |
Explanation | "Displays current memory usage |
Windows equivalent | updating it every five seconds." |
fsck
Filesystem consistency check and repair
Usage | fsck [options] [filesystem] |
Example | fsck /dev/hda1 |
Explanation | Performs a filesystem check on the first partition of the primary master IDE drive. |
Windows equivalent | chkdsk |
grep
Search file(s) for lines that match a given pattern
Usage | grep [options] string [file1] [file2] ... |
Example | "grep ""search string"" /home/*" |
Explanation | "Searches all files in /home for the occurence of the ""search string""." |
Windows equivalent | N/A |
gzip
Compress or decompress named file(s)
Usage | gzip [options] file |
Example | gzip index.html |
Explanation | Compressed index.html into a file named index.html.gz. |
Windows equivalent | N/A |
kill
Stop a process from running
Usage | kill [options] pid |
Example | kill 1234 |
Explanation | Terminates the process with id 1234. Use ps to determine a processes id. |
Windows equivalent | kill |
less
Display content one screen at a time
Usage | less [options] |
Example | cat index.html | less |
Explanation | "Displays the index.html file on the screen |
Windows equivalent | one screen at a time." |
ln
Make links between files
Usage | ln [options] target [linkname] |
Example | ln -s /var/www/html /home/user/website |
Explanation | Creates a shortcut named website from the user’s home directory to the /var/www/html directory. |
Windows equivalent | shortcut |
locate
Find files
Usage | locate [options] string |
Example | locate perl |
Explanation | Searches filesystem databases for files containing the term perl. |
Windows equivalent | dir /s |
ls
List information about file(s)
Usage | ls [options] [file/directory] |
Example | ls -la /var/www/html |
Explanation | Prints a detailed list of all files and directories located in the /var/www/html directory. |
Windows equivalent | N/A |
man
Help manual
Usage | man [options] [command] |
Example | man man |
Explanation | Displays the manual for the man command. |
Windows equivalent | N/A |
mkdir
Create new folder(s)
Usage | mkdir [options] directory |
Example | mkdir html |
Explanation | Creates a directory named html under the current directory. |
Windows equivalent | md |
mount
Mount a file system
Usage | mount [options] [device/directory] |
Example | mount cdrom |
Explanation | Mounts the CD-ROM drive. |
Windows equivalent | N/A |
mv
Move or rename files or directories
Usage | mv [options] source destination |
Example | mv index.html /var/www/html |
Explanation | Moves the index.html file from the current directory to /var/www/html. |
Windows equivalent | move |
nice
Set the priority of a command or job
Usage | nice [options] [comand [args]] |
Example | nice -n 19 httpd |
Explanation | Runs the httpd process with the lowest possible priority (-20 is the highest priority). |
Windows equivalent | N/A |
passwd
Modify a user password
Usage | passwd [options] |
Example | passwd |
Explanation | Prompts you to change the password for the current user. It will prompt for the old password first. |
Windows equivalent | N/A |
ping
Sends and echo packet to a host
Usage | ping [options] host |
Example | ping www.apcmag.com |
Explanation | Continually sends echo packets to the www.apcmag.com host. |
Windows equivalent | ping |
ps
Process status
Usage | ps [options] |
Example | ps -ef |
Explanation | Displays full list of all running processes. |
Windows equivalent | mem |
pwd
Print working directory
Usage | pwd [options] |
Example | pwd |
Explanation | Prints the directory the terminal is presently in. |
Windows equivalent | cd |
rm
Remove files
Usage | rm [options] file1 file 2 ... |
Example | rm -rf /var/www/html |
Explanation | Forces the removal of the /var/www/html directory and all files and subdirectories indside it. |
Windows equivalent | del |
rmdir
Remove folder(s)
Usage | rmdir [options] directory1 directory2 ... |
Example | rmdir /var/www/html |
Explanation | Removes the /var/www/html directory (assuming it’s empty). |
Windows equivalent | rd |
shutdown
Shutdown or restart Linux
Usage | shutdown [options] when [message] |
Example | shutdown -r 20:00 |
Explanation | Reboots the system at 8pm. |
Windows equivalent | shutdown |
sleep
Delay for a specified time
Usage | sleep [number] |
Example | sleep 30 |
Explanation | Pauses for 30 seconds — useful in some scripts. |
Windows equivalent | sleep |
su
Substitute user identity
Usage | su [options] [username [args]] |
Example | su |
Explanation | Switches to the root user. |
Windows equivalent | "su |
tail
Output the last part of files
Usage | tail [options] [file1] [file2] ... |
Example | tail /var/log/error.log |
Explanation | Displays the last 10 lines of the error log. |
Windows equivalent | N/A |
tar
Tape archiver
Usage | tar [options] file1 [file2] ... |
Example | tar - czvf archive.tar.gz /var/www/html |
Explanation | Compresses the contents of the /var/www/html directory into a gzipped tarball named archive.tar.gz. |
Windows equivalent | N/A |
touch
Change file timestamps
Usage | touch [options] file1 ... |
Example | touch /var/www/html/index.html |
Explanation | "Updates the timestamp on /var/www/html/index.html |
Windows equivalent | or creates the file if it doesn’t exist." |
top
List processes running on the system
Usage | top [options] |
Example | top |
Explanation | Provides an automatically-updating list of the most CPU intensive processes running on the system. |
Windows equivalent | N/A |
traceroute
Trace route to host
Usage | traceroute [options] host [packetsize] |
Example | traceroute www.apcmag.com |
Explanation | Prints a list of all routers (and IP addresses) that IP datagrams pass through en route to the www.apcmag.com server. |
Windows equivalent | tracert |
umount
Unmount a device
Usage | umount [options] [device/directory] |
Example | umount cdrom |
Explanation | Unmounts the CD-ROM drive. |
Windows equivalent | N/A |
unalias
Remove an alias
Usage | unalias [options] [name] |
Example | unalias la |
Explanation | Removes the alias named la. |
Windows equivalent | N/A |
uname
Print system information
Usage | uname [options] |
Example | uname -a |
Explanation | Prints all system information relating to the machine and OS. |
Windows equivalent | N/A |
which
Locate a program file in the user’s path
Usage | which [options] file ... |
Example | which perl |
Explanation | "Same as locate |
Windows equivalent | but restricts the search to the user’s path." |