Basic UNIX commands: Difference between revisions
>Mao mNo edit summary |
>Mao mNo edit summary |
(No difference)
|
Revision as of 15:17, 17 October 2008
The list of commands, used in UNIX shell (sh, bash, etc).
Basic File Operations
cd
Change Directory Use is very simple, and just like use of `cd` in DOS
cd ~/l33t/h4x/
Note that ~ is your home directory, if you need to see where you are (if your prompt doesn't display it, use:
pwd
mv
MoVe or rename a file
mv oldname.dix newname.dix
mv ~/olddirectory/file ~/newdirectory/file
Note that on *nix, moving and renaming files is essentially the same thing, as the entire path is considered part of the file name
cp
Captian Planet. I mean... CoPy
cp ~/old ~/new
Options
cp -R
Copies everything in a directory and subdirectories
scp
SFTP CoPy Like cp, but allows copying from one machine to another.
scp user@remote.machine.com:~/list.txt ./
If you wanted to copy an entire directory:
scp -r user@remote.machine.com:~/cake ./cake
Note that ./ is the current directory.
ls
Just listing file in current dirrectory
~% ls Mail codes mail mbox vk centericq.core dead.letter mails public_html zed
Options
Note, that options can be combined.
ls <dir>
Listing files in <dir> directory.
~% ls vk album.pl graffiti.pl img
ls -a
Listing ALL files (include hidden).
~% ls -a . .emacs.d .ssh codes vk .. .irssi .subversion dead.letter zed .bash_history .libetpan .vifm mail .bash_profile .links .zshrc mails .elinks .mc Mail mbox .elm .pinerc centericq.core public_html
ls -l
Showing items in nice list format.
~% ls -l total 4292 drwx------ 2 dany users 512 Apr 3 2007 Mail -rw------- 1 dany users 2138112 Oct 29 2007 centericq.core drwxr-xr-x 3 dany users 512 Sep 1 17:54 codes -rw------- 1 dany users 1 May 2 2007 dead.letter drwx------ 2 dany users 512 Apr 9 2007 mail drwxr-xr-x 2 dany users 512 Apr 2 2007 mails -rw------- 1 dany users 16926 Oct 29 2007 mbox drwxrwxrwx 5 dany users 512 Sep 10 16:20 public_html drwxr-xr-x 3 dany users 512 Jun 26 20:14 vk -rwxrwxrwx 1 dany users 1408 Jan 26 1999 zed