Some of the less common Linux commands

Source: Internet
Author: User
Tags case statement crypt delete key set time unpack egrep

Acctcom

View all processes performed by the user         acctcom | tail- View the processes/commands performed by the specified user        acctcom-u <username> | tail-20  Use a regular expression to find related processes      -n <pattern> | tail- Find all commands  that start with L -n ' ^l ' | Tail- b in reverse     order | more

Agrep

Find a word in the file that may be misspelled         Agrep-2 ' Macropperswan ' <file>

At

Execute a command at some point in the future     5 days < ScriptFile

Awk

Display the first column of the file         awk ' {print $1} ' <file> reverse-Display the first two columns of the file         awk ' {print $2, ' \ t ', $1 } ' <file> outputs the sum of the first two columns         awk ' {print $1 + $2} ' <file> find all including the ' money ' row and output the last column C11/>awk '/money/{print $NF} ' <file> find the second column contains "Money"    awk ' $2 ~/money/{print $< C15>0} ' <file> find third column does not include ' A '  awk ' $3 !~/a$/{print $0} ' <file>

Bc

Calculates the value of sin (5)       Echo ' s (5) ' | bc-l

CANCEL

Cancels a newly started print job cancel     <jobid> (Jobid can be handled by the case statement in the Lpstat-in esacsh/bash/ksh  

Cc

Compile a C file file.c    cc-o <outfile> <infile>

Cmp

Compare two files         cmp <file1> <file2> | | <command>

COL

Print man pages, remove "^h" man   <command> | col-b | <printcommand>

CRYPT

Encrypt a file with a password         crypt password < infile > cryptfile Decrypt a file     that was encrypted by the command above < Cryptfile > Cleanfile

CUT

Gets the hostname field from the output of the last command | cut-c11-

DATE

Set time (only by root)         date <mmddhhmm> output Specify date format (for example: month)    +%m

dircmp

Compare two directories         dircmp <dir1> <dir2>

ED

command-line compiler.     Ed <file>

EGREP

Use "or" conditional grep file Egrep ' (a| b) ' <file>grep file does not include A nor b     -V ' (a| B) ' <file>

EX

Use a shell pin to edit a file   ex-s files <<eofg/money/s//cash/

Eof

Edit a file with a script file         ex-s files < ScriptFile

EXPR

Modulo         7 See if the string is in the variable $var         expr $var : 'string' displays a string of the first number         Expr $ var : ' [^0-9]*\ ([a-z]*\) '

FGREP

Finds a file line that does not match a regular expression         fgrep ' *,/. () ' <file>

FILE

View file types (e.g. ASCII) files     <file>

FIND

A file found throughout the file system Find/-type f-name <file>-print finds all files that match the pattern find.-type f-name "*<foo>*"-Print Delete all core files in the system find/-type F-name CORE-EXEC/BIN/RM-f {} \; Find all files containing a word find.-type f-exec grep-l <word>{} \; Find all files that have been modified by 30 days ago find.-type F-ctime + --Print uses Xargs to back up all the. c Files (plus the. bak suffix) find.-name "*.C"-print | Xargs-i cp {} {}.bak only searches the local file system (does not search for NFS file system) find.-Local ... In the search process, follow the actual location of the link file find. -follow ... Find files larger than 1M find/path-size 1000000c-Print runs the Find command but ignores "permission denied" find ...2>/dev/NULL(Only in sh/bash/Ksh) Finding all the man directories find/-type D-print | Egrep '. */(catman|Man ) $ ' Find all directories with Write permissions find/-type D-perm-002-print

Grep

Find the file line that contains it in a regular expression     grep ' [a-z][0-9] ' <file> find a file line         that does not contain a specified regular expression -V ' ^from ' <file> Find a group of         files -l ' ^[cc] ' *. F calculation includes the number         of rows for a regular expression- c ' [ss]uccess ' <file>  Case-insensitive Lookup     -i ' LABEGF ' <file> the line number     of the output file before matching to the file content -n ' mo.*y ' <file>

HINV

The command displays a detailed list of system hardware, including: CPU type, memory size, and all disk devices.     hinv-v

LN

Create a link to a hard link file A to file a ln a B to create a symbolic link file a link      to file a -s a b delete link file b      rm b

Lp

Print files on the default printer     LP <file> print files     on the specified printer -d <destination> <file>

LPSTAT

Show all Printers         Lpstat-A View printer task queue      -o view default printer      -D viewprinter status      -p view plan any status          -R

Make

perform the first target in a makefile make    perform a pointing target         in a makefile <target> -F <mymakefile> show what to do but don't     do anything -N <target>

Nawk

Enhanced version of awk        

NL

Output files in a line number     Nl-bt-nln <file>

NOHUP

Start a command and quit now         nohup <command> &

PACK

A very old File packager, which is now replaced by Gzip.    Pack <file>

Usermod

Modify your account Properties         usermod username

PASTE

Combine multiple files in a column         paste <file1> <file2> > <newfile>

PR

Make a file in printable format (76 lines one page)    pr-l76-h "title" <filename>

regcmp

Compile regular expressions from a file     regcmp <file> File Content example         varname "^[a-z].*[0-9. *$"

RESET

Resetting the end device reset         

RPCINFO

Obtaining TCP port information for a host         rpcinfo-p 

RSH

Execute a command on a remote server     rsh 

SCRIPT

Used to capture all input and output results from the current terminal session to a specified file     script <logfile>

Sed

Replace Fred in a file with a     string         that matches the regular expression in John Sed-e ' s/fred/john/g ' <file> replacement file-E ' s/[0-9 ]+/number/g ' <file> to turn the "X" in the HTML file   into red- e ' s! X!<font color= "#FF0000 ″>x</font>! g; Rename all suffixes to. suf1. Suf2   -1 | grep ' \.suf1$ ' | Sed-e ' s/\ (. *\.\) SUF1/MV & \1suf2/' |  -E '/c/s/a/b/' <infile> ><outfile> Delete all file lines   containing "You owe me"- e '/you owe me/d ' & lt;infile> > <outfile> Use the commands in commandfile to compile the infile file and output it to outfile. The Commandfile contains a series of VI commands         - f <commandfile> <infile> > <outfile>

SHUTDOWN

Shutdown         shutdown-h nowsleep       sleep 10 sec.   

SORT

Sort each line of the file in character order sort         <file> sort         Each line of the file in numerical order- n <file> Reverse sort          -R <file> keep only one     for duplicates when sorting -U <file>

SPELL

Check spelling errors         spell <file> Check spelling errors, but ignore the words  contained in okfile +<okfile> <file>

SPLIT

Split a large file, each file 1m  split-b1m <file> Merge the split files together     cat x* > <newfile>

STRINGS

Reading an ASCII string from a binary file       strings <file>

STTY

Display Terminal Settings         stty-a setting Ctrl+ "h" for delete key    stty erase "^h" For user         input does not echo-echo echoesuser input     Stty Echosu switch to root user       su switch to root user and use its environment    su– switch to another user      <username>

TAIL

Displays a file line that contains the pattern in the end of a file in a file       tail-f <file> | grep <pattern>

TAR

Package the entire directory (without compression)      tar cvf <outfile>.tar <dir> Unpack a tar file   <file>. Tar first unpack and unpack     -DC <file>.tar.gz | Tar xvf– packaged into a compressed package          <file>tar.gz tape variable in. CSHRC to set the tar command         tape=/dev/rmt/0mbn Package A directory in        the directory referred to by the tape variable <dir> Unpack tar XV from tape to        extract a        file from tape <file> get a table of contents from tape  tar T copy a directory     && tar-cbf– with the appropriate permissions and links . ) | (CD Todir && tar-xbf–)

TEE

REDIRECT standard input to standard output who     | tee-a > <file>

TEST

Check if it is a file     test-a <file> Check if a file is the root         property -o/usr/bin/null test-N "$foo "Compare two numeric     strings in a number-GT $var 2 indirectly using" test "      if [[-A <file>]];then] in the Ksh script ...; Fi

Time

See how long it takes to run a command time         <command>

TOUCH

Update file is modified to the current time, file does not exist create file     touch <file>

Tr

Replace A,y replace b,c with x replace z        tr ' [a-c] ' [x-z] ' < infile > outfile

TRAP

Capturing "^c" and executing subroutines  012

TRUE

Let a non-existent command return 0      ln-s/usr/bin/true ranlib

TRUSS

To view a system call when a command is run         truss <command> >/dev/null

Typset

View the features that are activated         Typset

Tty

View the device file for the endpoint     TTY

ULIMIT

View the maximum file lengths supported by the system         Ulimit

UMASK

View current umask umask settings for a umask      077

UNIQ

See how many lines in a file are the same     sort <file> | uniq-c only output unique rows         without duplicates <file> | uniq-uuuencode      Encode a file to send e    -mail > codednameuudecode      Decode a     uuencoded file <file>

WAIT

Wait for a backward and run end         wait $jobid

Wc

Calculates the line number of a file     wc-l <file>

XARGS

Execute a command with standard output as a parameter         <command> | xargs-i grep ' pattern ' {}

XON

Get a xterm from another computer  Xon get everything         from another computer 

Some of the less common Linux commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.