CMD List [5]

1.1         rmdir

 

Deletes (removes) a directory.

 

Syntax             rmdir directory

 

Option or argument

Function

Directory

Specifies the directory you want to delete. (The directory must be empty already.)

 

To delete a directory and all the files in it, you can use the rm –ir command (see rm, earlier in this section). You cannot delete the current working directory, so move to its parent (by typing cd..) before deleting a directory.

 

1.2         sleep

Syntax        sleep Seconds

 

1.3         sort

Option or argument

Function

-b

Ignore leading blanks.

-c

Check if sorted. A nonzero value is returned if the input file is not correctly sorted.

-d

Sorts using dictionary order (ignore special characters).

-f

Ignore the case (change lowercase into uppercase).

-k

Sort key. Two method:

-k KeyDefinition

FSkip.CSkip (obsolescent version).

 

-k [ FStart [ .CStart ] ] [ Modifier ] [ , [ FEnd [ .CEnd ] ][ Modifier ] ]

[+[FSkip1] [.CSkip1] [Modifier] ] [-[FSkip2] [.CSkip2] [Modifier]]

 

-k[start field].[start column][option],[end field].[end column][option]

+[skip fields].[skip columns] [-option] -[skip fields to the end].[skip columns to the end] [-option]

 

e.g.

sort -t: -k2,2 n -k1,1 r vegetables

or

sort -t: +1 -2 -n +0 -1 -r vegetables

 

-k 3.2b,3r

or

+2.1b -3r

 

Note: The maximum number of fields on a line is 10.

-m

Merges multiple input files; the input are assumed to be already sorted.

-n

Sort in numeric order rather than alphabetic order.

-o

Output to outfile.

-r

Reverse order.

-tCharacter

Specifies single field separator character.

-u

Remove duplicate lines (deduplicate).

 

1.4         su

su [-] [ username  [ arg...]]

 

su become another user without logging off. The default user name is root (superuser). If (-) add can prevent the exception of $PATH. ( it is forbidden in some system as it can log in with root account)

e.g.

su - user2

 

1.5         sub

replace string.

sub (regexp,replacement_string,in_string), success return 1, not found return 0.

 

1.6         tail

show the last part of files. v.s. head.

 

Option or argument

Function

-f

Dynamic tail file. Be used to monitor the growth of a file.

 

e.g. tail -100 xxx           - cut the last 100 lines of xxx

 

1.7         touch

 

1. Changes the date and time of a file without changing the file’s contents; 2. Create files.

 

Syntax             touch [-a] [-c] [-m] [-t datefilenames

 

Option or argument

Function

-a

Changes only the date and time the file was last accessed.

-c

Doesn’t create files if they don’t already exist. If you use touch without this option on a nonexistent filename, it creates an empty file.

-m

Changes only the date and time the file was last modified.

-t date

Specifies the date and time to give to the file(s). The date and time must be in the format mmddhhnn, where mm is the month number, dd is the day number, hh is the hour(using a 24-hour clock), and nn is the minute.

Filenames

Specifies the file(s) whose date(s) and time(s) you want changed.

 

If you leave out the date, touch changes the files’ date and time to today, right now.

 

1.8         unalias

Removes alias definitions. v.s. alias.

 

1.9         unencode

change binary files into ascII files.

 

1.10     uniq

Remove duplicate entries ONLY if they are adjacent.

Option or argument

Function

-c

Add a count of how many times each line occurred.

-d

Display only the repeated lines. (duplicate)

-u

List only lines that are not repeated (non-duplicate)

e.g.

who | awk '{print $1}' | sort | uniq -c

 

1.11     w

To see who is logged on and what they’re doing.

 

1.12     wc

Counting words or lines.

Option or argument

Function

-w

Count by word.

-l

Count by line.

-c

Count by character.

e.g. wc –l xxx; tail -1 test.sh |wc

 

1.13     whereis

locate files in the system. Refer find.

Syntax             whereis [-bmsu] [-BMS folder_name -f] file_name

 

1.14     which

Locates a program file, including aliases and paths. e.g. > which pwd (response: > /usr/bin/pwd)

 

1.15     who

 

Tells you who else is using this computer.

 

Syntax             who [-q] [ami]

 

Option or argument

Function

-q

Displays only usernames, not terminal IDs or other information.

-m, am i

Displays your username, in case you have forgotten, or displays the username on any terminal that someone left logged in.

-u,i

Activity and PID of shell

 

Similar

w, users

 

1.16     whoami

1.17     xargs

Constructs parameter lists and runs commands.

e.g.

find /hsbc/rlse_bcn/objects -type f | xargs rm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值