- 论坛徽章:
- 0
|
Common UNIX 5VR4 Commands\r\nman – Online UNIX manual (“man-pages”); Gives\r\ndetailed instructions on all of the commands listed here\r\nand a lot more; See man man for more\r\ncat filename1 > filename2 – Overwrite contents of\r\nfilename2 with filename1\r\ncat filename1 » filename2 – Append contents of\r\nfilename1 to filename2\r\ncd /usr – Change current directory to /usr\r\ncd .. – Change current directory to previous higher\r\ndirectory\r\ncd – Change to home of current userid\r\nchgrp group1 filename1 – Change group id to group 1\r\nfor filename1\r\nchgrp -R group1 * – Change group id of all files in\r\ncurrent and subdirectories to group 1\r\nchmod ugo+rwx filename1 – Add read/write/execute\r\npermission to filename1 for user/owner, group and\r\nothers (world)\r\nchmod o x filename1 – Remove execute from others\r\n(world)\r\nchmod 751 filename1 – Set rwx for user/owner, group\r\nand others; r=4, w=2, x=1, rwx=7 rx=5, rw=6, wx=3,\r\nnone=0; see man pages\r\nchown sam filename1 – Change owner of file\r\nfilename1 to sam\r\nchown -R sam * – Change owner to sam for all files in\r\ncurrent and subdirectories\r\nclear – Clear the terminal screen\r\ncompress filename1 – Compress file filename1 and\r\nreplace it with filename1.Z; See also uncompress\r\ncp filename1 filename2 – Copy file filename1 to\r\nfilename2 destroying the contents of filename2\r\ncp -i * /usr/local/bin – Copy all files in current\r\ndirectory to /usr/local/bin directory; Prompt before\r\noverwriting files (i)\r\ncpio – Copy file archives to disk/tape; See man pages\r\ncrontab -e – Edit crontab file for current user\r\ncrontab -e bill – Edit crontab file for user bill\r\ncrontab -l – List crontab entries for current userid\r\ncsh – Start the c shell process; See man pages\r\ncut -d: -f1,5 /etc/passwd – Extract the 1st and 5th fields\r\n(username & real name) from file /etc/passwd where\r\ndelimiter is colon\r\nwho | cut -d\" \" -f1 – List login names from who\r\ncommand\r\ndate – Display current date string\r\ndate +%D – Display current date, MM/DD/YY format\r\n\r\ndd – Copy file(s) to/from raw devices; See man pages\r\ndf – Display free disk blocks and modes on file systems.\r\ndf -k – Display free space in kilobytes for mounted file\r\nsystems\r\necho name – Displays literal \"name\" on screen\r\necho $PATH – Displays PATH environment variable\r\ned/edit/ex – Alternative line editors, see vi\r\nenv – Displays current environment variables or allows\r\nsetting\r\nfile filename1 – Determines and displays type of file\r\nfor filename1 (text, data, executable, directory,\r\nsymbolic link...etc...)\r\nfind /usr/opt/bin -name \"filename1*\" -print – Starts\r\nsearching in /usr/opt/bin for files starting with\r\nfilename1; If found prints the full file names and\r\ncontinues searching subdirectories\r\nfind . -type f -print | xargs grep -i [PATTERN] –\r\nRecursive grep for a pattern in a file (searches through\r\nfiles in subdirectories)\r\nfind . ! -mtime -<days> | /usr/bin/xargs rm -rf –\r\nFinds and removes files older than <days> specified\r\nfinger sam – Displays data about user session for sam\r\nftp solar – Establishes a File Transfer Protocol session\r\nover the network between current host and a host\r\nnamed solar; See man pages for additional ftp\r\ncommands\r\ngrep jdoe /etc/passwd – Searches the file /etc/passwd\r\nsearching for string \"jdoe\"; If found, displays\r\ngrep -i Sam filename1 – Search filename1 for upper\r\nor lower case string of Sam and display lines found\r\ngroups sam – List groups that sam is a member of\r\nhead filename1 – Display first few lines of filename1\r\nhead -50 filename1 – Display first fifty lines of\r\nfilename1\r\nid – List current user id and any group ids\r\nkill -9 1351 – Terminate process number 1351\r\nksh – Start Korn Shell command interpreter; See man\r\npages; Preferred shell for most users\r\nln -s filename1 /usr/opt/filename2 – Create a\r\nsymbolic link named /usr/opt/filename2 that points to\r\nfilename1; See man pages\r\nlp -d lp1 filename1 – Print filename1 on destination\r\nprinter lp1\r\nlpstat -d – Displays name of default printer, if any\r\nlpstat -a – Lists printers accepting print requests\r\nlpstat -s – Displays most everything regarding printing\r\nlpstat -u sam – Displays status of sam\'s print jobs\r\nls -al – Displays all files in wide listing\r\nls -al *.doc – Displays files ending with .doc\r\n\r\nls -al /bin/k* – Displays files starting with k in /bin\r\ndirectory\r\nmail sam – Starts mail message to sam\r\nmailx sam – Nicer looking mail utility\r\nmkdir -p /usr/opt/dirx – Creates dirx below /usr/opt\r\nmake – Code compilation utility\r\nmkdir dirx – Creates directory dirx\r\nmore filename1 – Displays single pages from\r\nfilename1 pausing after each page; Many options;\r\nSee man pages\r\nmv filename1 /usr/opt/ – Moves filename1 to\r\ndirectory /usr/opt; Unlike the cp (copy) command,\r\nmv removes file from origin\r\nnetstat -i – Show the TCP/IP network interfaces\r\nnetstat -r – Show network route table\r\nnetstat -rn – Displays routing information but bypasses\r\nhostname lookup\r\nnetstat -a | more – Show the state of all sockets\r\nnewgrp group1 – Changes current group to group 1\r\nnews – Displays unread files from /usr/news or\r\n/var/news\r\nnice/renice – Adjusts process’ execution priority\r\npasswd – Allows changing your login password\r\nps – Lists all of current user\'s live processes\r\nps -ef – List all users processes that are executing\r\npwd – Displays current working directory you are in\r\nrcp filename1 hostb:/usr/local/bin – Copies\r\nfilename1 from current host system to hostb, and\r\nplaces it in the /usr/local/bin directory; The .rhosts or\r\nhosts.equiv files must be setup to allow action\r\nrksh – Starts restricted Korn Shell session\r\nrlogin hostb – Logs into remote host name hostb\r\nrm filename1 – Deletes filename1 from the disk\r\nwithout recourse\r\nrm -i filename1 – Deletes filename1 after prompting\r\nfor verification\r\nrmdir dirx – Deletes directory dirx\r\nrmdir -r dirx – Deletes directory and all contents\r\nrsh – Restricted version of Bourne Shell for security\r\nsar – System Activity Reporter\r\nsh – Bourne Shell command interpreter; Alternative to\r\nKorn Shell and C shell but is the default on most\r\nsystems; Older version that is losing popularity\r\nsleep 3 – Pauses for 3 seconds and continues\r\nstty sane – Attempts to restore terminal settings after\r\nthey are hosed; Use CTRL-J with this command\r\nstty erase ^H – Use to reset backspace/delete; ^H is\r\nthe key you may want to use for backspace/delete;\r\nTypically the backspace key itself |
|