Linux常用指令

学习Linux:http://www.ee.surrey.ac.uk/Teaching/Unix/unix2.html

输入 % man +操作指令 即可获得该指令的说明手册

eg:

man find

CommandMeaning
lslist files and directories
ls -alist all files and directories
mkdirmake a directory
cd directorychange to named directory
cdchange to home-directory
cd ~change to home-directory
cd ..change to parent directory
pwd

display the path of the current directory                                                                                    

CommandMeaning
cp file1 file2copy file1 and call it file2
mv file1 file2move or rename file1 to file2
rm fileremove a file
rmdir directoryremove a directory
cat filedisplay a file
less filedisplay a file a page at a time  q to quit
head filedisplay the first few lines of a file
tail filedisplay the last few lines of a file
grep 'keyword' filesearch a file for keywords
wc filecount number of lines/words/characters in file
CommandMeaning
command > fileredirect standard output to a file
command >> fileappend standard output to a file
command < fileredirect standard input from a file
command1 | command2pipe the output of command1 to the input of command2
cat file1 file2 > file0concatenate file1 and file2 to file0
sortsort data
wholist users currently logged in
CommandMeaning
*match any number of characters
?match one character
man commandread the online manual page for a command
whatis commandbrief description of a command
apropos keywordmmatch commands with keyword in their man pages
Commandchmod
SymbolMeaning

u

user

g

group

o

other

a

all

r

read

w

write (and delete)

x

execute (and access directory)

+

add permission

-

take away permission
% chmod go-rwx biglistremove read write and execute permissions on the file biglist for the group and others, type
% chmod a+rw biglistTo give read and write permissions on the file biglist to all
CommandMeaning
ls -laglist access rights for all files
chmod [options] filechange access rights for named file
command &run command in background
^Ckill the job running in the foreground
^Zsuspend the job running in the foreground
bgbackground the suspended job
jobslist current jobs
fg %1foreground job number 1
kill %1kill job number 1
pslist current processes
kill 26152kill process number 26152
CommandMeaning
% df .The df command reports on the space left on the file system.
% du -s *

The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files.

The -s flag will display only a summary (total size) and the * means all files and directories.

% gzip science.txtto compress science.txt
% gunzip science.txt.gzTo expand the file, use the gunzip command.
% tar -xvf units-1.74.tarextract the contents of the tar file
%zcat science.txt.gzzcat will read gzipped files without needing to uncompress them first.
% zcat science.txt.gz | lessIf the text scrolls too fast for you, pipe the output though less .
% file *file classifies the named files according to the type of data they contain, for example ascii (text), pictures, compressed data, etc..
% diff file1 file2This command compares the contents of two files and displays the differences.
% find . -name "*.txt" -printTo search for all fies with the extention .txt, starting at the current directory (.) and working through all sub-directories, then printing the name of the file to the screen
% find . -size +1M -lsTo find files over 1Mb in size, and display the result as a long listing,
% historyThe C shell keeps an ordered list of all the commands that you have entered. Each command is given a number according to the order it was entered.(show command history list)

% !!

% !-3

% !5

% !grep

% set history=100

(recall last command)

(recall third most recent command)

(recall 5th command in list)

(recall last command starting with grep)

You can increase the size of the history buffer by typing

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值