NOTE: Some DOS commands have an equivalent for deleting/modifying
directories, most UNIX commands on the other hand simply use a flag or
option. Most programs accept options by typing "programname -options"
Many commands use the "-r" or "-R" option to delete directories or copy
them. This -R/-r means recursive, try dictionary.com for that one.
Second NOTE: UNIX commands are CASE sensitive, meaning "ls" is not the
same thing as "lS". Meaning when you type a command, type it as you see
it, without the quotes.
ls: Show files in directory, the equivalent of the ms-dos "dir"
cd: Change directory. Same as the ms-dos "cd" command, for example:
"cd /xspace" will move you into the /xspace directory.
mv: Move, move directories or files, also the equivalent of the
rename command in DOS. For example "mv blah .." will move blah
one directory up. Or "mv blah black" will rename blah as black.
rm: Remark, or also known as remove/delete, the equivalent of the
dos del/deltree command. To delete a directory, use the -R flag.
"rm blah" would delete the file blah, to delete a directory, "rm
-r somedir" will recursively delete the directory and all it
cp: Copy, to copy files/directories. "cp blah blah1" would make a
copy of the file blah with the name of blah1. "cp -r blah blah1"
would be if blah was a directory. Again notice the -r option for
directories. -r in these commands means "recursive" look it up.
cat: concatenate or print files. cat will basically print the
contents of a file, whether it is binary or text. Shows the data
in the file, "cat blah" would show me the contents of blah, if it
were a program, I would most likely see lots of extended ASCII
chars and hear lots of beeps.
man: Manual page, most decent programs/commands will have a man page
type "man command" to view the manual page for that command.
Linux tends to have Poor, spotty, inconsistent man pages. OpenBSD
tends to have the best.(I am a OpenBSD user so I am biased).
du: Shows file size, on OpenBSD at least, du -k will show the amount
of kilobytes the file uses.
df: Show the amount, and percentage, of free space/used on a
partition. Again, df -k will show everything in Kilobytes.
Quick intro to ownership:
This is kinda necessary for the below.....
Anyways, UNIX/Linux are multi user operating systems. Meaning, one users
files/programs/everything is separate from other users. The user that
owns a file is called the owner. Files also have a group, meaning the
group they are owned by, usually they are group whoever owns the file.
But a file can easily be owned by 'root' and group 'wheel' meaning,
anybody in the group wheel will be able to do whatever the group
permissions allow them to.
Then there is the 'other' category, meaning everyone not the owner or in
the group that the file is.
Chmod is the command used to alter file permissions. UNIX being a
multi-user operating system(compared to the single user environment of
windows 9x) allows you to decide who can do what to your files.
Try typing "ls -l" sometime, the -l means long format, which shows file
permissions as well as some other file properties. Probably will looking
something like this, note, below output is taken directory from my home
directory. Also, it gives each column a field number for future
reference, this is not what will be displayed using ls:
Field 1 2 3 4 5 6 7 8 9
-rwxr-xr-x 2 stevenm stevenm 23 Apr 9 07:42 .plan -> /bin/sh
-r-x---r-x 1 stevenm stevenm 7383 Apr 9 07:45 PERL
-rw------- 6 stevenm stevenm 2983762 Apr 6 02:32 pornmovies
-rw------- 1 stevenm stevenm 5837 Apr 9 05:34 pornpics
drwx------ 1 stevenm stevenm 612 Apr 9 01:22 cdrom
Lets take a look at the most important field here, field number 1, this
shows the permissions on the file. Lets analyze this for a second:
-rwx------ The first dash will be a 'd' if it is a directory, then the
next 3 spaces are the permissions for the owner. So that rwx there means
what the owner of the file can do.
r = read
w = write
x = execute
So -rwx------ would mean that it is a file, and the owner can read, write,
and execute it.
The next set of 3 spaces are the group permissions. So -rwxr-x--- would
mean that the owner can read, write and execute it, and the group of the
file can read and execute it.
The last 3 spaces mean what others can do to that file, meaning if they
aren't in the group of the file, they don't own the file, then they are
'other'. So the following perms: drwxr-xr-x would mean that it is a
directory (the d at the beginning) and the owner can read write and
execute the file. The group can read and execute, and others can read and
Field 2 is unimportant. Field 3 where it says 'stevenm' for the first
time is the owner of the file/dir. The second stevenm, or field 4, is the
group of the file. Field 5 is the size of the file/dir in bytes.
Field 6-8 is the date and time the file was last modified. Finally, field
9 is the name of the file or directory.... that .plan -> /bin/sh means
.plan is linked to another file, in this case /bin/sh, so when you view
the contents of .plan or modify it, your modifying /bin/sh. For more on
symlinks see 'man ln'.
Applying permissions with chmod can be done in two ways, using numeric
notation, or symbolic notation.
The numeric notation is what most UNIX users use, as it is shorter and
more powerful. I will start with symbolic notation for the sake of
Symbolic notation uses 3 letters, or symbols to represent permissions.
u = owner
g = group
o = others
Lets use the pretend file "blah" without the quotes. If the file blah
already had the permissions -rwx------ and I wanted to make it so people
in the same group as me could write to it, I would do: "chmod g+w blah"
although that isn't useful without read so "chmod g=rw blah".
Lets analyze above two commands.
"chmod g+w blah" what this means is, add (w)rite permissions to the file
blah for (g)roup. Pretty simple. Now, "chmod g=rw blah" can be used to
apply all the perms for a category at once, so "g=rw" means, the perms for
group are read and write. Using = applies whatever you put after it as
the total perms, meaning, if g currently had just execute permissions,
that would change completely to read and write, = overwrites the current
Here are some examples:
"chmod g+rw blah" add read and write for group
"chmod o+rx blah" add read and execute for others
"chmod o= blah" others cannot read write or execute
"chmod u+rwx blah" add read, write, and execute for the owner
"chmod o-rwx blah" remove read write and execute permissions for others
Using + will add the permissions to the file, not overwriting any current
permissions. - obviously will remove those permissions if it currently
exists. = will overwrite all permisions for that field.
Numeric notation tends to be more powerful, and faster. Using numerical
notation is personally my preferance.
Using numerical notation, consider each set of 3 a place value, for
example, the first 3 dashes(owner perms) are the hundreds place, and the 3
middle dashes(group perms) are the tens place, and the last 3 dashes are
the ones place(other perms). Using numerical notation, a number
represents each possible permission.
4 = read perms
2 = write perms
1 = execute perms
0 = no perms
So, to apply rwx for owner, you add all these together, and get 7, for
owner perms that 7 would go in the hundreds place, so lets say you want to
make 'blah' rwx by owner, and nothing for group or others. You would do:
"chmod 700 blah". See, by adding the number for read write and execute,
we get 7, and that goes in the hundreds place, 0 is no perms so we put a 0
in the tens(group) and ones(others) places.
The best way with numerical notation is probably to see examples so here
"chmod 755 blah" 4+2+1=7 for owner, 4+1=5 for group and others. This
would make blah look like -rwxr-xr-x .
"chmod 644 blah" 4+2=6 for owner, 4 = read for group and others. This
would make the perms look like -r-xr--r-- .
"chmod 700 blah" 4+2+1=7 for owner, 0 = no perms for group and others. This
would make the perms look like -rwx------ .
"chmod 722 blah" 4+2+1=7 for owner, 2 = write for group and others. This
would make the perms look like -rwx-w--w- BTW: This would
be a very stupid thing to do.
at : execute commands at a specified time/date.
awk : a scripting language, especially useful for manipulating text and
bash : invokes the Bourne Again Shell (standard on most boxes).
batch : execute comands when load permits.
bc : interactive C-like calcultor (integers only).
cal : displays a calender, also lets you choose month/year using parameters.
calender : invoke a reminder service.
cancel : cancel request to calender.
cat : concatenate files (displays a file without scrolling ability. Simply
dumps it to the standard output. Can be useful when chaining multiple
applications to do complicated jobs, so one application can use another's
output as input).
cd : change the current working directory.
chgrp : change group ownership of a file.
chmod : change access patterns (permissions) to files.
chown : change user ownership of files.
clear : clear the screen.
cmp : compare two files.
cp : copy files.
cpio : archive and extract files.
cron : clock deamon (executes "batch" and "at" commands).
crontab : schedules commands at regular intervals.
crypt : encrypt , decrypt files using altered DES, standard to Unix
passwords (restricted distribution).
csh : invoke the C shell.
csplit : split file into several other files.
cu : call up another unix terminal.
cut : cut selected fields from each line of file.
date : displays the time and date (can also change it if you're root).
dd : convert and copy a file.
df : reports space (free, total etc') on all mounted file systems.
diff : copare two files.
diff3 : compare 3 or more files.
dircmp : compare two directories.
du : report disk usage.
echo : echo argument to standart output.
ed : line oriented editor.
egrep : extended version of grep (searches for extended regular expressions).
fgrep : same as grep, only it interprets patterns as a list of fixed strings.
expr : evaluate boolean and arithmetic expression.
false : return nonzero (false) exit status.
file : report type of file.
find : find matching files and run specified programs on them (optional).
finger : report user information (operates remotely only if a finger server
is running on the remote host).
ftp : (file transfer protocol) a client for FTP servers.
grep : search files for regular expression matches.
haltsys : gracefully shutdown sytem (can only be run by root. halt in Linux).
head : display first 10 lines of a file.
join : display the combination (lines with command field) of two fields.
kill : send a signal to terminate a process.
ksh : invoke the korn shell.
line : read a specific line out of a file (shell script usage).
ln : create a link to a file/directory.
logname : gets your login name.
whoami : which user you are logged in as at the moment. If you, for example,
switch to a different user, logname will show the original username you
logged in as, and whoami will show the current user.
lpr : sends a request to printer.
lprint : prints on local printer.
lpstat : reports printer status.
lpq : same as above.
ls : lists the contents of directory.
mail : send and recieve mail.
man : displays manual pages.
mesg : grant or deny permissions to recieve messages from other users using
the write command.
mkdir : create a new directory .
mknod : build a special file.
more : display file one page at a time.
mount : mount a storage device.
mv : move or rename a file.
news : display news item from NNTP servers.
nice : change priorities of processes.
nohup : run a command after logout (ignores hangup signals).
nroff : format files for printing.
nslookup : retrieve information from DNS servers.
od : displays a file in 8-based octals.
passwd : create or change login password.
paste : merge lines of files.
pr : format and print file.
ps : reports status of active processes.
pstat : report system status.
pwcheck : check /etc/passwd (default) file.
pwd : display current working directory.
rm : remove (erase) files or directories (unrecoverable).
rmdir : remove an empty directory.
rsh : invoke Restricted Bourne Shell.
sed : the stream editor.
set : assign value to variable.
setenv : assign value to enviroment variable.
sh : invoke Bourne shell.
sleep : suspend execution of a command for a given period.
sort : sort and merge files.
spell : find spelling errors.
split : split file to smaller files.
stty : set options for a terminal.
su : spawns a subshell with a different username, requires other user's
password, unless you're root.
sum : compute checksums and number of blocks for files.
tabs : set tabs on a terminal.
tail : display last 10 lines of file.
tar : a simple compression tool that merges multiple files into a single one,
originally made to make backing up materials on backup tapes easier.
tee : create a tee in a pipe.
telnet : access remote systems using the telnet protocol.
test : test various expressions and files.
time : display elapsed time (execution, process, and system times) for a
touch : change time/date stamps of files.
tr : substitutes sets of charecters.
translate : translates files to different format.
troff : format files to phototypester.
true : return zero (true) exit status.
tset : set terminal mode.
tty : report a name of a terminal.
umask : set file-creation mode (permissions) mask.
umount : unmount a device.
uname : display the name of the current system.
uniq : report any duplicate line in a file.
units : convert numbers from one unit to another.
unzip : extract files from zip archieve.
uptime : report system activety.
uucp : copy files between two unix systems (oldie but still beautiful).
uulog : report uucp status.
uuname : list uucp sites known to this site.
uudecode : decode to binary after "uuencode" transmission.
uuencode : encode binary file for email transmission.
uustat : report status of uucp or cancel a job.
uupick : receive public files sent bu uuto.
uuto : send files to another public Unix system.
uux : execute command to remote Unix system.
vi : a screen oriented (visual) editor (cool ,but Vim is better).
wall : sends message to all users (root only).
wait : await completion of background process.
wc : count lines, words, bytes etc' in one or more files.
who : report active users.
whois : search for user information.
write : send a message for another user (see mesg).
zip : archieve file or files in zip format
whereis - checks the standard binary directories for the specified name, printing out the paths of any it finds that are executable by the user.
slocate - provides a secure way to index and quickly search for files on your system
xkill - a utility for forcing the X server to close connections to clients
lsof - list open files (I use it sometimes to see what's keeping my cdrom from opening lsof /media/cdrom)
top - display Linux tasks
which - shows the full path of (shell) commands
Shpresoj qe tju hyjne ne pune