unixxx

2
cp Copy files cp my fi le your fi le Copy the fi les "myf il e" t o the fi le "y ourf il e" i n the c ur rent working directory. This command will create the file "yourfile" if it doesn't exist. It will normally overwrite it without warning if it exists. cp -i myfil e your file Wi th the "-i" optio n if the fi le "yo urfil e" exi sts you wi ll !e  prompted !efore it is overwritten. cp - i dat amyfi le . Copy the fil e " dat amy fil e" t o t he c urr ent wor king di rec tor y and name it "myfile". #rompt !efore ov erwriting the file. cp -dpr srcdi r dest dir Copy all files from t he dire ctory " srcdi r" to t he dire ctory "destdir" preserving links $-p option% file attri!utes $-p option% and copy recursively $-r option%. With these options a directory and all it contents can !e copied to another directory. dd dd if&devhd! of&!ackup (isk duplicate. The man page says this command is to "Convert and copy a file" !ut although used !y more advanced users it can !e a very handy command. The "if" means input file "of" means output file. df )how the amount of disk space used on each mounted filesystem. less less textfile )imilar to the more command !ut the user can page up and down through the file. The example displays the contents of textfile. ln Creates a sym!olic link to a file. ln -s test symlink Creat es a sym!ol ic link named s ymli nk t hat points to the file test Ty ping "ls -i test symlink" will show the two files are different with different inodes. Typing "ls -l test symlink" will show that symlink points to the file test. locate * fast data!ase driven file locator. slocate -u This command ! uilds the s locate data!ase. I t will take several minutes to complete this command. This command must !e used !efore searching for files however cron runs this command periodically on most systems. locat e whe re is +i sts all f iles wh ose names co nt ai n t he st ri ng "whe rei s". logout +ogs the current user off the system. ls +ist files

Transcript of unixxx

 

cp Copy files

cp myfile yourfile Copy the files "myfile" to the file "yourfile" in the current

working directory. This command will create the file"yourfile" if it doesn't exist. It will normally overwrite it

without warning if it exists.

cp -i myfile yourfile With the "-i" option if the file "yourfile" exists you will !e

 prompted !efore it is overwritten.

cp -i datamyfile . Copy the file "datamyfile" to the current working directory

and name it "myfile". #rompt !efore overwriting the file.

cp -dpr srcdir destdir Copy all files from the directory "srcdir" to the directory"destdir" preserving links $-p option% file attri!utes $-p

option% and copy recursively $-r option%. With these options

a directory and all it contents can !e copied to anotherdirectory.

dd

dd if&devhd!

of&!ackup

(isk duplicate. The man page says this command is to

"Convert and copy a file" !ut although used !y more

advanced users it can !e a very handy command. The "if"means input file "of" means output file.

df  )how the amount of disk space used on each mounted

filesystem.

less

less textfile)imilar to the more command !ut the user can page up anddown through the file. The example displays the contents of

textfile.

ln Creates a sym!olic link to a file.

ln -s test symlink Creates a sym!olic link named symlink that points to the file

test Typing "ls -i test symlink" will show the two files are

different with different inodes. Typing "ls -l test symlink"

will show that symlink points to the file test.

locate * fast data!ase driven file locator.

slocate -u This command !uilds the slocate data!ase. It will take

several minutes to complete this command. This commandmust !e used !efore searching for files however cron runs

this command periodically on most systems.

locate whereis +ists all files whose names contain the string "whereis".

logout +ogs the current user off the system.

ls +ist files

 

ls +ist files in the current working directory except those

starting with . and only show the file name.

ls -al +ist all files in the current working directory in long listingformat showing permissions ownership si,e and time and

date stamp

more *llows file contents or piped output to !e sent to the screen

one page at a time.

more etcprofile +ists the contents of the "etcprofile" file to the screen one

 page at a time.

ls -al more #erforms a directory listing of all files and pipes the outputof the listing through more. If the directory listing is longer

than a page it will !e listed one page at a time.

mv ove or rename files

mv -i myfile yourfile ove the file from "myfile" to "yourfile". This effectivelychanges the name of "myfile" to "yourfile".

mv -i datamyfile . ove the file from "myfile" from the directory "data" to the

current working directory.

pwd )how the name of the current working directory

more etcprofile +ists the contents of the "etcprofile" file to the screen one

 page at a time.

shutdown )huts the system down.

shutdown -h now )huts the system down to halt immediately.

shutdown -r now )huts the system down immediately and the system re!oots.

whereis )how where the !inary source and manual page files are for

a command

whereis ls +ocates !inaries and manual pages for the ls command.

/ditors0 emacs vi pico 1ed vim