|
CEG 333: Introduction to UnixPrabhaker MatetiTen Essential Commands |
The Ten Most Essential Commands for Unix Users are ls,
cd, mkdir, rm, top, ssh, sftp, xterm, emacs and
make. So far, you have seen them all except
top and make which will be covered soon
after the midterm.
| Command | Examples | |
ls |
ls -l |
List files, showing all their information. |
ls -a |
Show all files (even hidden ones). | |
cd |
cd myFiles |
Change to "myFiles" as the current working directory. |
cd - |
Go back to the previous working directory. | |
mkdir |
mkdir XYZ |
Create a new dir named XYZ |
rm |
rm [filename...] |
Delete the specified files.
WARNING: Once deleted, a file CANNOT be recovered! DANGER: On most Unix systems, this command will act without asking for confirmation! |
rm -r [FILE OR DIRNAME...] |
Remove the given directories and all their contents. WARNING: ALL FILES in these directories will be deleted! |
|
rm * |
Delete EVERYTHING in the current
directory. If used
with "-r" this will delete
recursively and thus remove directories and their contents
too! |
|
ssh |
ssh s001xyz@unixapps1 |
secure shell login to unixapps1 |
sftp |
sftp s001xyz@unixapps1 |
secure FTP |
xterm |
terminal window | |
emacs |
emacs file.txt |
powerful editor |
top |
TBD |
|
make |
TBD |
|
Notes
grep
-ri means do a search that is both case-insensitive and
recursive.Here are a few more useful commands.
| Command | Summary | Examples | |
cat |
Show each file in sequence (concatenate). | cat [filename...] |
Display the specified files on the screen. |
cat [filename...] > newfile |
Combine the given files into one file, named "newfile." | ||
pwd |
Print name of current/working directory. | ||
cp |
copy files
WARNING: If a file is accidentally over-written, it's gone for good! |
cp file1 file2 |
Copy "file1" to "file2". |
cp [filename...] dirname/ |
Copy the given filenames into the directory called "dirname". | ||
cp -r dir1 dir2 |
Copy the directory named "dir1" and all its contents to "dir2". | ||
mv |
move or rename files
WARNING: If a file is accidentally over-written, it's gone for good! |
mv file1 file2 |
Rename "file1" to "file2". |
mv [FILE AND DIRNAME...] destdir/ |
Move the given files into "destdir". | ||