A Dangerously Brief Unix Primer
This Primer is "dangerous" because it barely touches on the complexity of what you can do with the Unix shell.
You should also know that, in Unix, most settings and important user information is contained in text files in your home directory. This means that you can easily mess up your account if you play around with files you don't know about and/or understand.
With that in mind, here are some basic commands that will be helpful if you are just starting out with the Unix shell.
FYI, the default shell on ECES is tcsh.
|
cd {directory}
|
Change to the given directory.
|
|
cd
|
Change to your home directory.
|
|
ls
|
Directory listing.
|
|
ls -la
|
Directory listing with more information.
|
|
mv {file} {destination}
|
Move {file} to {destination}. If {destination} is a file, it will be overwritten. You can use mv to "rename" a file.
|
|
rm {file}
|
Remove {file}.
|
|
cp {file} {destination}
|
Copy {file} to {destination}.
|
|
chmod setting {file}
|
Change the permission settings on the given file. See setting for details.
|
|
chgrp {group} {file}
|
Change the group ownership of {file} to {group}
|
|
pico
|
Launch a simple, menu driven text editor.
|
|
pico {file}
|
Edit the given file. If it doesn't exist, it will be created.
|
|
less {file}
|
Show the contents of a text file.
|
|
man {command}
|
Get some information on the given command.
|
Settings for chmod
Chmod can be run with numeric or letter settings.
Numeric settings are as follows:
4 READ
2 WRITE
1 EXECUTE
0 NO PERMISSIONS
Add these together to get the desired setting.
Then string three sums together to get the full setting for the file. First digit is the setting for the user (you), second for the group, and third for everyone.
For example:
chmod 744 foo
Will make the file foo readable, writable, and executable for the user, but members of the group and everyone else will only have read privileges.
Chmod settings can also be changed with letters.
r READ
w WRITE
x EXECUTE
u USER
g GROUP
o OTHER
+ ADD PERMISSION
- REMOVE PERMISSION
For example:
chmod g+wr foo
Will add write and read permissions for the group to the file foo.
|