0% found this document useful (0 votes)
417 views

Unix Command Cheat Sheet

The document provides a cheat sheet of Unix commands organized into categories like general help, basic commands, admin commands, searching for files and directories, file editors, user and group permissions, tarring and zipping files, and basic chmod permissions. It explains what each command does and examples of common uses.

Uploaded by

copierpro
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
417 views

Unix Command Cheat Sheet

The document provides a cheat sheet of Unix commands organized into categories like general help, basic commands, admin commands, searching for files and directories, file editors, user and group permissions, tarring and zipping files, and basic chmod permissions. It explains what each command does and examples of common uses.

Uploaded by

copierpro
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tips by TheDocBlog : Webmaster

Tips and Resource Blog


Read advanced tutorials, guides, and how to articles on all aspects of Adult Web
Development.

Unix Command Cheat Sheet


TheDoc · Wednesday, January 25th, 2006

Below is a broken down list of Unix commands you may find useful

© Tips by TheDocBlog : Webmaster Tips and Resource Blog · URL of this document: http://thedocblog.com/unix-command-cheat-sheet-49.html · Document created: May 27th, 2009, 3:27 pm
within most Unix command shells.

General help & info: type text within quotes


help & help help Basic help listings.
man command Example: man whois Brings up the manual for that
command.

* Press CTRL+C to escape from help, manual menus and other full
window options.

Basic Commands:
who or w Displays who is currently logged on the server & the user
information.
uptime How long the server has been running.
date Shows the current system date.
whoami Who you are logged in as, your user.
df Displays how much disc space is left on each drive / partition.

General Commands:
pwd Displays your current directory.
cd dirname or cd /full/directory/path/ Changes your directory.
cd websites or cd /usr/local/www/domain.com/www/
cd.. Backup a directory (cdup is the same as cd..)
cd ../../../ Backup 3 directories.
su Brings up password prompt for root user.
su username Changes the login to that username.
ls and ls -l Typed within a directory for a directory listing.
mkdir dirname Creates a directory.
mv olddirectory newdirectory Renames a directory or file to a new
name.

Admin Commands:
top What's running, load averages, server status information.
rm -r directory Removes a directory permanently.
cp filename /path/to/new/location/ or cp filename /directory/ Moves file
to a new location.
cp directory /path/to/new/location/ Moves that directory into the given
path directory.
cp directory/ /path/to/new/location/ Movies the files within that
directory to within the new location.
dig domain.com Displays name server, name servers, and other
information about the domain.
finger username Displays information about a username and group
status
ps ax Lists all processes running on the server.
kill pid pid=process id. This command terminates the process # or id.
netstat Active Connections On The Machine.
ln -s /target/path/to/open linkname Creates a short cut / symbolic link
to a target directory.

Searching For Files & Directories:


locate filename.ext or locate filename Searches system for file name.
locate filename | more Sorts into pages, use the spacebar to advance.
whereis filename Tells the path location to a file.

File Editors & File Viewing:


vi filename.ext Opens the VI editor. VI Editor Information.
pico filename.txt Basic Unix Text Editor. Pico Information.
more filename.txt Displays one page of the file at a time. Spacebar for
more.

User & Group Permissions & Information:


id username Displays information about the username
groups username Displays what group the username belongs to.
passwd username Change the password for a username.
userdel username Deletes a username from the system.
userdel -r username Deletes user and users home directory.
chsh username Changes the shell to that user.

Tarring & Zipping Files:


tar -cvzf mytar.tar.gz directory/ Creates a new tar file of the files within
that directory.
tar -xvf mytar.tar.gz directory Dumps the contents of the file to given
directory.
gzip directory Creates a compressed file of that directory.
gunzip file.gz Dumps the contents of the file to that file names
directory.

Basic Chmod / Permission Commands:


Sometimes you may need to chmod a file or directory. To do this cd
(change directory) to the location of the file or directory you need to
modify.
chmod ### filename or chmod ### directory Changes the permissions
on the file or directory.
chmod -r ### directory Changes the permissions on all files within the
directory.

Most common chmod commands you will use: (chmod with


WS_FTP)
chmod 777 file/directory Gives read, write and execute access for
everyone on a file. Most open type of permission.
chmod 755 file/directory
Gives read and execute access for everyone on a file. Gives write
access to the owner file / the person who installed the file.
chmod 666 file/directory Gives read and write access for everyone on
a file. Often log files.

Hope This Helps,


~ TheDoc

This entry was posted on Wednesday, January 25th, 2006 at 8:01 pm and is filed under Admin & Servers
You can follow any responses to this entry through the Comments (RSS)
feed. You can leave a response, or trackback from your own site.

Tips by TheDocBlog : Webmaster Tips and Resource Blog is proudly powered by WordPress.
PDF created by ContuttoPDF.

You might also like