Вы находитесь на странице: 1из 6

ls command Lists the files in the current directory, in alphanumeric order, except files starting with the . character.

ls -a ls -l ls -t ls ls -r ls -ltr - (all) Lists all the files (including. *.files) - (long) Long listing (type, date, size, owner, permissions) - (time) Lists the most recent files first - (size) Lists the !iggest files first - (re"erse) #e"erses the sort order - (options can !e com!ined) Long listing, most recent files at the end. $ile name pattern su!stitutions ls *txt %he shell first replaces *txt !y all the file and directory names ending !y txt (including .txt), except those starting with., and then executes the ls command line. ls -d .* Lists all the files and directories starting with .-d tells ls not to display the contents of directories. cat &.log 'isplays all the files which names start !y ( character and end !y .log The cd and pwd commands cd )dir* +hanges the current directory to )dir*. cd ,ets !ac- to the pre"ious current directory. pwd 'isplays the current directory (.wor-ing directory.).

The cp command cp )source/file* )target/file* +opies the source file to the target. cp file( file0 file1 ... dir +opies the files to the target directory (last argument). cp -i (interacti"e) 2s-s for user confirmation if the target file already exists cp -r )source/dir* )target/dir* (recursi"e) +opies the whole directory. mv and rm commands m" )old/name* )new/name* (mo"e) #enames the gi"en file or directory. m" -i (interacti"e) 3f the new file already exits, as-s for user confirm rm file( file0 file1 ... (remo"e) #emo"es the gi"en files. rm -i (interacti"e) 2lways as- for user confirm. rm -r dir( dir0 dir1 (recursi"e) #emo"es the gi"en directories with all their contents Creating and removing directories m-dir dir( dir0 dir1 ... (ma-e dir) +reates directories with the gi"en names. rmdir dir( dir0 dir1 ... (remo"e dir) #emo"es the gi"en directories afe4 only wor-s when directories and empty.

2lternati"e4 rm -r (doesn5t need empty directories). Displaying file contents e"eral ways of displaying the contents of files. cat file( file0 file1 ... (concatenate) +oncatenates and outputs the contents of the gi"en files. more file( file0 file1... 2fter each page, as-s the user to hit a -ey to continue. +an also 6ump to the first occurrence of a -eyword (7 command). less file( file0 file1 ... 'oes more than more with less. 'oesn5t read the whole file !efore starting. upports !ac-ward mo"ement in the file (& command). The head and tail commands head 8-)n*9 )file* 'isplays the first )n* lines (or (: !y default) of the gi"en file. 'oesn5t ha"e to open the whole file to do this; <xample4 head -=: daxuser/menu>.php1 3t displays first =: lines of code of the file. tail 8)-n *9 )file* 'isplays the last )n* lines (or (: !y default) of the gi"en file. ?o need to load the whole file in #2@; Aery useful for huge files. <xample4 tail -=: daxuser/menu>.php1 3t displays last =: lines of code of the file.

tail Bf )file* (follow) 'isplays the last (: lines of the gi"en file and continues to display new lines when they are appended to the file. Aery useful to follow the changes in a log file, for example. <xample4 tail Bf daxuser/menu>.php1

The grep command grep )pattern* )files* cans the gi"en files and displays the lines which match the gi"en pattern. <xample4 grep .href. daxuser/menu>.php1 grep error *.log 'isplays all the lines containing error in the *.log files grep -i error *.log ame, !ut case insensiti"e grep -ri error *.log ame, !ut recursi"ely in all the files in . and its su!directories The sort command sort )file* orts the lines in the gi"en file in character order and outputs them. <xample4 sort daxuser/menu>.php1

sort -r )file* ame, !ut in re"erse order. sort -ru )file* u4 uniCue. ame, !ut 6ust outputs identical lines once. clear it will clear the screen(short cut ctlDl) syntax4 8rootEnettech root9Fclear exit to end a current session as well current terminal logging syntax 8rootEnettech root9Fexit touch to create a new empty file syntax 8rootEnettech root9Ftouch man to "iew the manual page of commands for syntax

8rootEnettech root9Fman m-dir info to "iew the information a!out any command

8rootEnettech root9Finfo m-dir --help to "iew the help documents of a command

8rootEnettech root9F m-dir --help dir to "iew the su!directories and filesn under the directory

8rootEnettech root9Fdir who !y this command you can see the user name and their ip addresses who ha"e loged in on your ser"er 8rootEnettech root9Fwho

whoami name

this command shows your current logged in terminal user

8rootEnettech root9Fwhoami who am i this command shows you the logged in terminal num!er and user name and more detailed information

Вам также может понравиться