Common Unix Commands

Source: Internet
Author: User
Tags perl script egrep

Apropos

Purpose: Search for the name of the instructions.

Example: apropos print (equivalent to man-K prink ).

Arch

Purpose: arch to obtain the description of the machine architecture.

Example: arch. The output result of arch is as follows: sun4

Compare this command with uname.

Ash

Purpose: ash is a shell used only for some systems.

Example: ash. This command starts an instance of the ash shell.

At

Purpose: At is used to determine the time when the command is executed.

Example: at am December 31.

Awk

Purpose: awk is a Mode Scanning and Execution Language.

Example: awk/'{print $1}/'file.txt. After this command is executed, the first region of file.txt will be printed.

Bash

Purpose: Bash is the GNU Bourne-again shell.

For example, bash [Options]. This command starts the bash shell, which is an enhanced shell compatible with SH. The bash prompt is $.

Biff

Purpose: BIFF indicates whether you have received an email.

Example: Biffy. This command is called Biff to notify you when the new mail will arrive (note that you must run Sendmail at the same time to make the Biff work ).

Cancel

Purpose: Cancel cancel a pending print job.

Example: cancel23. This command cancels the print job on the 23rd.

Cal

Purpose: display the non-formatted text calendar with Cal.

Example: Cal. The following is the list output after the command is executed: August 1998

Cat

Purpose: CAT concatenates files and displays the content in these files.

Example: CAT myfile.txt. After this command is executed, the content in myfile.txt is displayed.

CC

Purpose: CC is a C compiler for many systems.

Example: CC myfile. C-o myfile. After this command is executed, compile the myfile. C source file and output an executable file named myfile.

CD

Purpose: use CD to change the current directory.

Example: CD/usr/bin. After this command is executed, change the current directory to/usr/bin.

Chfn

Purpose: chfn is used to change finger information.

Example: chfn (the system will prompt you to make changes ).

Chgrp

Purpose: chgrp is used to change the group ownership of files.

Example: chgrp users/home/bwagner /*. After this command is executed, everyone in the "users" group can access my files. (Bwagner represents your user name)

Chmod

Purpose: chmod is used to change the permission of a specified object.

Example: chmod = r myfile.txt. After executing this command, change the permission of myfile.txt to read-only.

Chown

Purpose: chown is used to change the ownership of a file.

For example, chown bwagner myfile.txt. After this command is executed, grant the permission of myfile.txt to me.

Clear

Purpose: Clear the screen.

Example: Clear.

Comm

Purpose: comm compares two files row by row.

Example: comm myfile.txt yourfile.txt. After this command is executed, the myfile.txtand yourfile.txt files are compared.

Compress

Purpose: compress is used to compress a file. After compression, the file is given a. Z extension. Compare this command with gzip.

Example: compress myfile.txt. After executing this command, compress myfile.txt and give it a. Z extension. The last file name is myfile.txt. Z.

CP

Purpose: CP is used to copy files.

For example, CP myfile.txt yourfile.txt. After executing this command, copy the content of myfile.txt to a file named yourfile.txt.

CSH

Purpose: CSH is a C shell.

Example: CSH. Run this command to start the C shell. After starting CSH, you can see that the running environment has changed, because the system prompt has changed from $ to %.

Cu

Purpose: Cu calls another system using a standard outbound line.

Example: Cu 5555555. After this command is executed, call another system by phone number 5555555.

Cut

Purpose: Cut is used to delete columns or rows in a file.

Example: Cut-C2 myfile.txt. After this command is executed, Column 2nd (the command opposite to cut is paste) in the myfile.txt file will be deleted ).

Date

Purpose: date is used to obtain the date and time.

Example: Date. The following is the output list after the date command is executed:

Wed Aug 5 19:10:42 PDT 1998

DF

Purpose: report the free space available on the disk.

Example: DF. The following lists the output results after the command is executed:

Diff

Purpose: Use diff to compare two files and report their differences.

Example: Diff myfile.txt yourfile.txt. After this command is executed, compare the myfile.txtand yourfile.txt files. Diff displays all the different rows in the two files. Compare the command with the comm and uniq commands.

Dir

Purpose: Dir is used to list the contents of directories on some platforms.

For example, Dir (DIR has the same functions as LS, but it has fewer options. DIR is not suitable for all UNIX systems ).

Du

Purpose: Report disk usage by Du.

Example: Du. The following is the list output after the du command is executed.

Echo

Purpose: ECHO is used to display the specified text content.

For example, Echo "this is my workstation .". After this command is executed, the following information is printed on the screen:

This is my workstation.

Ed

Purpose: Ed is a simple no-frill text editor.

Example: Ed.

Egrep

Purpose: Use egrep to find the mode that meets certain requirements in the file. When this Command finds the specified mode, it prints the corresponding lines on the screen.

Example: egrep "I am bored" myfile.txt. After executing this command, you will find the I am bored string in the myfile.txt file.

Elm

Purpose: elm is a popular email client program.

Example: Elm. This command will start the ELM email reader.

File

Purpose: report the data type in a specified file.

Example: file *. The following is the output list after the file command is executed:

Find

Purpose: Find is used to find files in a directory.

Example: find.-Name * GIF. After this command is executed, find all the files with the. gif extension in my main directory or under the main directory. The following is the output list after the find statement is executed:

Finger

Purpose: finger is used to report user information.

Example: Finger bwagner. After this command is executed, all currently available information related to me will be listed.

Purpose: fsck is used to check and modify the file system.

Example: fsck/dev/DSK/cot1d0s0. Fsck is a command with potential threats. Before using this command, read the instructions related to it.

FTP

Purpose: FTP is used to transfer files between hosts.

For example, FTP traderights.pacificnet.net. After this command is executed, connect the local machine to traderights.pacificnet.net. FTP has many options and flags. Find the instructions for using this command for further information.

G

Purpose: G ++ is the GNU project C compiler.

For example, G ++ myfile. C-o myfile. After this command is executed, the program compiled in C ++ is compiled and the executable file named myfile is output.

Gawk

Purpose: gawk is the GNU free version of awk.

Example: awk/'{print $1}/'file.txt. After this command is executed, the first area of the file.txt file will be printed.

Gcc

Purpose: GCC is the GNU project C and C ++ compilers.

For example, GCC myfile. C-o myfile. After this command is executed, compile the myfile. C source file and output the executable file named myfile.

Grep

Purpose: grep is used to search for text lines in a certain mode and print all corresponding lines.

Example: grep ecoli hamburger.txt. After this command is executed, find the word "ecoli" in the hamburger.txt file.

Gunzip

Purpose: Use gunzipto compress or uncompress a file (usually a file with a .gz extension ).

Example: gunzip myfile.txt.gz. After this command is executed, the myfile.txt file will be uncompressed.

Gzip

Purpose: Gzip is used to compress or decompress files.

Example: gzip myfile.txt. When executing this command, compress myfile.txtand upload a compressed file named myfile.txt.gz. The compressed file can be decompressed using gzip or gunzip (compare this command with gunzip ).

Halt

Purpose: Stop the system running with halt.

Example: Halt.

Head

Purpose: by default, head outputs the first 10 lines of any file.

Example: Head myfile.txt. After this command is executed, the first 10 lines of myfile.txt will be displayed on the screen.

Hostname

Purpose: Use hostname to print the Host Name of the machine.

Example: Hostname.

Ispell

Purpose: ispell is an interactive spelling check program used on Linux.

For example, ispell myfile.txt. This command will start the ispellenvironment and check whether the myfile.txt file has a spelling error.

Kill

Purpose: Kill is used to terminate a process.

Example: Kill 529. After this command is executed, the 529th process will be terminated.

Ksh

Purpose: Ksh is the Korn shell.

Example: Ksh. This command will start the Korn shell.

Last

Purpose: Last is used to report the logon date and time of a user.

Example: Last bwagner | head-3. After this command is executed, I will output the last three logon times. Ln

Purpose: ln is used to establish links between files.

Example: ln myfile.txt another-file.txt. After this command is executed, the link between myfile.txt and another-file.txt will be established. Once such a link exists, modifications to a file will lead to modifications to another file.

Lp

Purpose: LP is used to send files to the printer.

For example, LP myfile.txt. After this command is executed, send myfile.txt to the printer.

LPR

Purpose: LPR is used to send a job to a printer (LPR is an equivalent LP Berkeley command ).

Example: LPR myfile.txt. After this command is executed, send myfile.txt to the printer.

Lprm

Purpose: lprm is used to delete a job from the printer queue.

Example: lprm 23. After this command is executed, job 23rd will be deleted from the printer list.

Lpstat

Purpose: lpstat is used to report the status of a pending print job.

For example, lpstat.

Ls

Purpose: ls is used to list directory content.

Example: ls/home/bwagner. After this command is executed, the contents in the/home/bwagner directory are listed. The typical command line switch of LS includes-A (listing all files, including hidden files) and-l (listing all directories in long format ).

Mail

Purpose: mail allows users to send and receive emails.

Example: CAT myfile.txt | mail bwagner. After this command is executed, mail the content in myfile.txt to me (you can also use mail interactively, as long as you send the MAIL command ).

Man

Purpose: Man is the interface of the UNIX reference manual. These manuals are generally called man pages ).

Example: Man mail. After this command is executed, mail instructions will be started.

Mkdir

Purpose: Use mkdir to create a specified directory.

For example, mkdir Bozo-mail. After this command is executed, a directory named Bozo-mail will be created.

More

Purpose: More is used to display the content of a screen at a time on the screen.

Example: More myfile.txt. After this command is executed, the content in myfile.txt is displayed on one screen at a time. This makes it easy to read more than 40 lines of files.

Mount

Purpose: mount the file system to install and uninstall it.

Example: Mount/dev/fd0/mnt/floppy. Run this command to install the first floppy disk drive in the/mnt/Floop directory.

MV

Purpose: use music videos to move files.

Example: MV myfile.txt/usr. After this command is executed, move myfile.txt to the/usr directory.

Nroff

Purpose: nroff format the text file as required by a row printer or terminal screen.

Example: nroff myfile.txt. After this command is executed, a clear and elegant output result is generated.

Passwd

Purpose: passwd is used to change the user password.

Example: passwd (the system prompts the user to make changes ).

Paste

Purpose: paste is used to merge file rows or outputs.

Example: Who | awk/'{print $1}/' | paste --. After this command is executed, obtain the current user ID and print them in the row and column format. Two-Symbols specify the column format.

Perl

Usage: Perl (Practical Extraction and Report Language) is a powerful text scanning language.

Example: Perl-E/'print "Hello word // n ";/'. After this command is executed, the following information is displayed:

Hello word

Perl can be used to compile complex programs. However, these programs cannot be typed in the command line. Instead, they are stored in Perl script files (text files containing many Perl commands ).

Pico

Purpose: Pico is a free text editor available in some UNIX versions (especially Linux ).

For example, Pico myfile.txt. This command starts picoto edit myfile.txt.

Pine

Purpose: pine is an e-mail and Usenet software package that can be obtained free of charge (many UNIX systems also include it, but pine is most common in Linux systems ).

Example: pine. This command starts the Pine email reader.

Ping

Purpose: Ping to check whether other hosts are running and in good status.

For example, Ping 207.171.0.111. The following is a list of Ping output after running the ping command on the Linux instance:

207.171.0.111 is alive

For other systems, the ping command output is different. Printenv

Purpose: printenv is used to print all the current environment variables.

For example, printenv. The following is the output list after the printenv command is executed:

PS

Purpose: PS is used to report the status of the current process.

Example: PS-. After this command is executed, all processes are printed. The output list is as follows:

Purpose: Use PWD to display the current directory name.

Example: Pwd. After this command is executed, the current directory name is printed.

RCP

Purpose: RCP is used to copy files from a remote host.

Example: RCP Tigger:/home/poo/files.txt files.poo.txt. After this command is executed, the file file.txt will be copied from the host "Tigger" and the file name will be changed to files.poo.txt in the local host.

Rlogin

Purpose: rlogin indicates remote login (Remote logon ). Rlogin is used for automatic logon on the network consistent with the user ID information.

Example: rlogin Tigger. This command starts a remote conversation between the local host and the "Tigger" host.

Rm

Purpose: Rm is used to delete a specified empty directory.

For example, RM myfile.txt. After this command is executed, myfile.txt will be deleted.

Rmdir

Purpose: delete an empty directory with rmdir.

For example, rmdir/mydirectory. After this command is executed,/mydirectory will be deleted.

Sh

Purpose: Sh is a UNIX shell.

Example: Sh. This command will start the Unix shell.

Sort

Purpose: Sort classifies text files row by row.

Example: Sort myfile.txt. This command classifies the content in myfile.txt.

Stty

Purpose: display or change terminal settings in stty.

For example, stty [Options]. Stty has 1 million options.

Tail

Purpose: by default, tail displays the last 10 rows of the specified file.

Example: tail myfile.txt. After this command is executed, the last 10 lines of myfile.txt will be displayed on the screen. You can also specify the number of lines displayed. For example, after tail-50 myfile.txt is executed, the last 50 lines of text will be printed on the screen.

Talk

Purpose: Talk allows you to chat with another user.

Example: Talk bwagner. This command invites me to chat.

Telnet

Purpose: Telnet allows you to perform remote sessions with other hosts.

Example: Telnet 202.194.14.236. This command will start the local machine to connect to 202.194.14.236.

Traceroute

Purpose: trace the path through which the Group transmits Node B (a remote host) from node A (your machine. This command is usually used to determine whether a fault exists in the network.

Example: Traceroute mcp.com. The following is the output list after traceroute is executed:

Purpose: tty display the current terminal name.

Uname

Purpose: uname is used to obtain system information, including the architecture, operating system, and processor type.

Example: uname-. The following is an example output after uname execution:

SunOS wagjag 5.6 generic sun4u iSCSI sunw, ultra-1

Uniq

Purpose: uniq searches for duplicate rows in the specified file and deletes them.

Example: uniq myfile.txt.

Uptime

Purpose: How long has the uptime reporting system been running so far.

Example: uptime. The following is an example output after the command is executed:

PM up 4 day (s), 14 users, load average: 0.00, 0.01, 0.02

VI

Purpose: VI is a text editor.

Example: VI myfile.txt. This command starts Vito edit myfile.txt.

Wall

Purpose: Wall sends a specified message to all terminals.

Example: wall work sucks !!. After this command is executed, the following message is printed on all terminals:

Work sucks !!

WC

Purpose: Calculate and display the number of bytes, number of words, and number of lines in a specified file using WC.

Example: WC myfile.txt. This command displays the statistics of myfile.txt.

Whatis

Purpose: whatis provides a brief description of a specified command.

For example, whatis. After this command is executed, the description of whatis is displayed. The output list is as follows:

Whatis (1)-display manual page descriptions

Whereis

Purpose: whereis is used to determine the file location.

Example: whereis traceroute. Run this command to find the traceroute file.

Who

Purpose: who displays the statistics of logged-on users.

Whoami

Purpose: whoami displays your current user ID.

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.