Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Friday, March 20, 2009

Quick list of unix shell commands

Some Unix or Linux shell commands.

Cancel a command

Ctrl+U, Ctrl+X, or @

Change the working directory to /usr

cd /usr

Change the working directory back to your home directory

cd

Copy a file

cp oldfile newfile

Copy a file to another directory

cp oldfile dirname

Copy a bunch of files (e.g. filename1, filename2, ...) to another directory

cp filename* dirname

Copy all the files in this directory and in all its subdirectories

cp -r * newdir

Erase a file

rm filename

Rename a file

mv oldname newname

Move a file to another directory

mv oldfile dirname

List filenames

ls

List filenames with sizes and dates

ls -l

List hidden files too

ls -al

List files and pause when screen is full

ls | more

Look at a text file

cat filename

Look at a long text file

more filename

Make a new link (name) for a file

ln oldname newname

Make new links (names) for files in a directory

ln dirname/* newdir

Combine two files

cat file1 file2 > newfile

Compare two files

diff file1 file2

Look at the manual page for the ls command

man ls

Change your password

passwd