| | | | Sample: | |
| | rm | remove files(remove directory -rf) | rm -rf tset | |
| | mkdir | make directory | mkdir test | |
| | chmod | change mode | chmod 755 *.ksh | |
| | mv | move file | mv lujinan.txt test/ | |
| | mv | rename file | mv lujinan.txt lujinan.txt.858 | |
| | grep | search file context | grep 'for' ./* | |
| | sed | text process | | |
| | > | redirect output &clear file content | echo "abc" > test.txt & >filename | |
| | >> | append | echo "abc" >> test.txt | |
| | cat | check the file contents | cat test.ksh | |
| | less | per line | less test.ksh | |
| | more | per screen | more test.ksh | |
| | < | redirect input | | |
| | awk | | ls -l|awk '{print $1}' | |
| | cp | copy file | cp /home/userId/a.txt b.txt | |
| | scp | copy file from other server to current server | scp $userId@otherServerName:/home/userId/a.txt /home/userId/b.txt | |
| | | | | |
| | control + insert | COPY | | |
| | shift + insert | PASTE | | |
| | control + c | stop the running shell | | |
| | ~ | $HOME | | |
| | . | current directory | | |
| | / | root | | |
| | touch | create 'dstamp" file and create time is May 4 21:40 | touch -t 05042140 dstamp | |
| | find | find directory and files | LINUX_and_UNIX_SHELL_program->002.pdf | find pnl* |
| | | | find . -name fileName* -exec ls -ltr {} \; | |
| | tail | | tail -f fileName 动态输出文件尾部内容 | |
| | diff | c | compare | |
| | | a | after > | |
| | | d | before < | |
| | wc | count the file lines | |
| process | ps | use ps to see the processes that you are running | | |
| bg | use ctrl-Z to suspend the foreground task, and then use bg. | |
| fg | use fg to move a background task to foreground
| | |
| kill | kill [-<signal>] <pid> | kill -9 <pid> 强制杀死进程 | |
| killall | killall [-<signal>] <command> | | |
| | Commands that tell you who you are: | | |
| | whoami | displays your username | | |
| | id | displays your username and groups | | |
| | Commands that tell you who others are: | | |
| | finger [<name>] | displays info for <name>
| | |
| | id [<username>] | displays info for <username>
| | |
| | Commands that change who you are: | | |
| | su <username> | “switch user” to <username>
| | |
| | | | | |
| | df |
(disk free)display the amount of available disk space for filesystems
| | |
| | | | | |
| | login | login as a different user | | |
| | To view a single environment variable’s value: | | |
| | | echo $<name >
| | |
| | For example: | | | |
| | | echo $HOME | | |
| | To view all environment variables at once: | | |
| |
sh/ksh: set
| | | |
| | tcsh/csh: | | | |
| |
setenv < name > <value>
| | |
| |
Example: setenv AA aa
| | |
| | bash/ksh: | | | |
| |
export < name >=<value>
| | |
| | There is no space on either side of ‘=’! | | |
| |
Example: export AA=aa
| | |
| | sh: | | | |
| |
< name >=< value >; export < name >
| | |
| | Aliases | | | |
| | Syntax: | | | |
| | bash/ksh: | | | |
| | alias <text >=’< replacement >’
| | |
| | tcsh/csh | | | |
| | alias <text > ’< replacement >’
| | |
| | | | | |
| Eclipse | Ctrl+ H | File content search | | |
| | Ctrl+ space | sysout->System.out.println(); | | |
| | Ctil+Shift+f | format codes | | |
| | Ctil+Shift+t | find the jar package | | |
| | | | | |
| | | | | |
| | | | | |
| | ls -t1|head -n 1 | find the best new file | ls pnl.* | |
| | | | | |
| | ksh: diff_nameWithJob.ksh: No such file or directory | need to convert to Unix format | | |
| | number=`expr $number + 1` | calculate number | | |
| | | | |
| | | | | |
| | | | | |
| | | | |
| | | | | |
| | | | | |
| Flex&Eclipse | | | |
| | Ctrl+Shift+c | /* */ comment code | | |