26. Common Commands Used Within UNIX

/ - root directory (when by itself)
| - (pipe) redirects output
~ - (tilde) means home directory (so instead of typing /mine/home/paul/work, you could type ~ work)
Control C – will cancel current job (control key + c)
Control Z – pauses jobs (control key + z)

admintool – takes you to the GUI administration tool
alias
– brings up set of words that will execute a program (syntax: alias cls = clear [cls is what you want the new command to be, clear is what it really is], another example is alias ll = ‘ls –l’ (this would allow you to put in options with the command)
arp
– (address resolution protocol) will help in figuring out addresses of computers at – for setting up jobs at a later specific date

batch – for running a group of processes at a later date
boot – reboots the system

cal – will show 1 month of calendar (cal 1998 will show entire year)
cat
– will redirect things
cd (change directory) – changes from your current directory to a new one (cd alone takes you to your home directory, cd.. takes you up in the file structure one point, cd/ takes you to the root directory)
chgrp
– changes the group assigned to a file
chmod
– changes permissions to files or directories (i.e. chmod /export/home/paul/myfile u+rwx (u=user, g=group, o=other)
chown – changes the owner of a file.
cow – copy on write (when RAM shares it will only read unless you need it, then it will copy)
cp – (copy) makes a copy of a file or directory (i.e. cp [source] [destination], cp –r will copy an entire directory structure) (cp –p will preserve all permissions)
cron - for setting up chronological jobs (to make things happen an unspecified later date)
crontab –l - (shows all your current cron jobs)
crontab –e - (this starts) (lets you edit your cron jobs)

df –k – shows the number of free disk blocks, and shows mount points, as well as other information
dfshares
– will show what files are being shared

eject – ejects a tape or cd
env
– shows environment variables
export – exports variables to other shells

find - searches for a directory or file (find [where to look] [criteria] [dirname] [action to do], i.e. find / -name ptree –print) another way is where is ptree or man ptree
file
– will tell you what type of file a file is (i.e. ascii, directory, etc.)
format
– for formatting disk, and partitioning
ftp (file transfer protocol) – this is for transferring files remotely
fuser – will tell who is using directory, and other options

grep (global recursive expression protocol) – searches for arguments you provide (i.e. grep [what you are looking for ] [where to look] (i.e. grep hosts /etc)
groupadd
– adds a new group
groupdel
– deletes a group

halt – shuts the system down
head – shows first ten lines of file (head –20 will show first 20, etc)

id – shows all your information (about yourself)
ifconfig
– (interface configuration) for setting up interfaces
init - changes the initialization state of the system

jobs – shows what jobs are running in a shell

kill – ends a job or process (to see jobs and processes use job and ps command)

last - shows who was logged on last
last reboot – shows history of boots
lp – print
lp [name of file] – print file to default printer
lp –d [name of print queue] [file to print]
– will put a file in a specific print queue.
lpstat – check status of print queue
lpadmin –d [name of printer] – sets default printer (to set a personal default printer edit the .cshrc (or other environment file) with the following setenv lpdest mydesk, the setenv is standard, the lpdest is the printer that you want as your default (ip or name) and mydesk is the name of the queue.
ls (list) – shows contents of a directory

man – shows manual pages
mkdir
– makes a directory (to make multiple directory’s do: mkdir 1stdir 2nddir 3rddir)
modinfo – lists all current kernel modules
modunload –i 96 – takes out all modules (96 number of mod takes out just the specified mod)
modunload –l 0
– unloads all modules not in use
more & page
– will pause (i.e. ls –l | more)
mount
- will create a file structure
mv (move)
– moves a file from one directory to another, and can rename files (ie mv word work, would rename the file word to work)

netstat – show the network’s status
newfs
- creates a new files system
nl
– counts line numbers
nslookup
– looks up information about name services

passwd – use to change password
ping
- for checking connections to interfaces and networks (i.e. ping 192.168.0.2)
ps
– shows system processes (-f shows full list)
pwd (present working directory)
– shows current directory

rcopy – (remote copy protocol)
reboot
- reboots the system
rlogin
– (remote login), to connect to another computer
ruser
- shows who is on network

shutdown – shuts the system down
snoop
– for monitoring processing within the system

su (switch user) – allows you to switch between user account, or to become superuser (a.ka. root).
swap
– “page out” will move stuff from memory if it’s not used

tail – shows last ten lines of file (tail –20 will show last 20, etc)
telnet
– for remotely connecting to computers
touch
– creates an empty file
truss
– allows you to see a program as it is run

ufsdump (UNIX file system dump) – will backup your system
uname
– tells you information about yourself
umask
– shows default permissions of a file (i.e. umask 027 (applies to shell your in) filename umask only), this command tells what permission are denied using octals.
umount
– unmounts a file structure
unalias
– removes an alias (i.e. unalias ll)
useradd
– adds a user account
userdel
– deletes a user account

vi – this command takes you to the text editor program vi

wc – counts number of lines, paragraphs and characters (goes before the filename)
who
– shows who is presently logged on to the system
whoami or who am i
– shows information about yourself
which [command name ]
- will show the path of the command
write
- sends a message to a user (i.e. write joe <return>[message you want to send])

Examples:

ls –F /usr | grep –c

cat /etc/passwd> password


  Go to Chapter 25       Go to Index        Go to Chapter 27