Absolutely Important UNIX Commands


Absolutely Important UNIX Commands

 

cat fList contents of file
cat f1 f2 >f3Concatenates f1(file 1) & f2(file 2) into f3(file 3)
cdreturns you to your home or main directory
cd /takes you to the root, as far up (to the left) as far as possible
cdto move down (right in the pathname) a directory
cd ..moves you up (left in pathname) a directory; likewise,
cd ../../..moves you up (left in the pathname) 3 directory levels
chmod ###changes your protections.  The order is:  you|group|universe (rwxrwxrwx). 
There will be either a d or - before it.  If there's a d, then it's a directory.  If there's not, then it's a file. 
You set the protections in the order rwx (read=1, write=2, execute=4).  So, to set the protections for the
directory directoryname:  you rwx, group r-x, universe r--, you would enter:  chmod 751 .
clearto clear screen
compresscompresses the file filename and puts a .Z extension on it.  To uncompress it, type uncompress
cp f1 f2Copy file f1 into f2
cp -r D1D2copies the directory D1 and renames it D2
^-c (ctrl-c)to kill a running process
^-d (ctrl-d)to close an open window
dfgives disk usage
diff f1 f2Lists file differences
dig hostdomain name, IP address, and alias information for the given host.
dosdirto do a "dir" (~ls in UNIX) on a DOS floppy in the disk drive
dosreadto read a file from a DOS floppy to your computer account
doswriteto write a file from your computer account to a DOS floppy
dulists all subdirectories and their sizes (in blocks?)  and total directory size (in blocks?) (takes a long time)
du -alists all files and their sizes (in blocks?) in present directory and total directory size (in blocks?) (takes a long time)
du -slists overall directory size (in blocks?) (long but clean)
envshows current environment set-up
findSearches the named directory and it"s sub-directories for files. Most frequently called like this: 
find ./ -name "t*" -print
Which searches the current directory ( and all of its sub-directories ) for any files that begin with the letter "t" and then prints them out. If you are looking for a specific filename, then replace "t*" with "filename", and "find" will print out all incidences of this file.
finger @.(e.g., finger johndoe@ksu.edu fingers Johndoe at Kent State University)
ftpestablishes an ftp link with machinename
gzipproduces files with a .gz extension.
gunzipdecompress files created by gzip, compress or pack.
ispell fInteractively checks the spelling of the file f, giving logical alternatives to the misspelled words. Type "?" to get help. "ispell" can be accessed from the command line, and also through emacs with M-x ispell-buffer.
kill -9 -1(from a remotely logged-in site) kills all running processes (essentially forces a logout) *not to be used unless nothing else works*
 kill -9 process-id# - kills a running process
lpqshows UNIX print queue
lprto print the file
lpqrm job#removes job from printer queue
lsshows listing of files in present directory
ls -ashows listing of all files in present directory
ls -lshows long listing of files in present directory
ls -la | moreshows long listing of all files in present directory
man commandshows help on a specific command.
mkdir Dcreates a new directory called D
moreto view the contents of a file without making changes to it one screen at a time.  Hit q to quit more.
mv f1 f2Rename file f1 as f2
mv f1Dmoves the file called f1 to the directory D
nslookup hostdomain name, IP address, and alias information for the given host.
e.g., nslookup www.kent.edu gives related data for www.kent.edu
passwdto change your password (takes an hour or so to take effect on all machines)
ping hostto test if the host is up and running.
pwdpresent working directory
psShows processes running
ps -fluShows detailed description of processes running
pquotaShows printer quota
quota -vShows current disk usage and limits.
rloginallows you to remotely log in to another machine on which you have access privileges
rm fDelete (removes) the file f.
rm -i fTo be prompted for confirmation before you remove a file f, at the UNIX prompt, type
rm dir DDelete (removes) the empty directory D
rm - r Dremoves the directory named D and its contents - use with caution
fAlphabetically sort f.
talkestablishes an e-talk session with user@machinename
tarcombines multiple files into one or vice-versa
telnetallows you to remotely log in to another machine on which you have access privileges
uncompressuncompresses filename.Z
usersshows who's logged in on the machine
vito open the file called filename in the vi text editor
whoShows who is currently logged on the system.
whoamishows username of person logged in that window
whois domain_namelists the domain registration record, e.g., whois kent.edu will produce the domain record for kent.edu
*wild card character representing any # or characters 
dateshows the time and date
date -ushows greenwich mean time
.a short cut that stands for the location you are at in a pathway. ex. cp (file (though a pathway) (. (the location you are at)
..move to parent directory from any comand ex. mv (file name) ..  or cd .. etc. 
pwdshows where you are in the pathway
?wild card character representing one character, can be used in succesion
~abbreviation for the home file ex. ls ~ lists files in home dir w/o moving there 
zipbest compression for IBM files.





Tags:

Laxman Singh

0 comments

Leave a Reply

Related Posts Plugin for WordPress, Blogger...