|
Be sure to check out the forums! Enter The Forums
Basic Usage Unix Commands
Plus a chmod intro
This is for the most part just some basic commands for moving through the
file system, and some file modification commands. The command is show on
the left with a colon after it, then a description and example usage(for
some of the more "complicated" commands).
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"
command.
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
contents.
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.
Those are the basic commands use to navigate and copy/move data. If your
using a shell account, and you try these commands, but are either denied
or not there, and your VERY sure you used it right, bitch to the sysadmin
because that is a fucked up shell account.
Here are some commands use to set file permissions, or modify the ability
to alter files, otherwise known as permissions.
chmod: Change file permissions, please see the end of this file as this
command requires a more detailed description than here.
chown: change the owner of a file, like "chown stevenm blah" would make
blah owned by stevenm, usually, you cannot change the owner of a
file(for example one of your own) to someone else.
chgrp: same as chown except changes the group of a file, rules about
being able to change the group of your files to someone else is
the same as chown.
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 intro:
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
|