Stanfo Programming Tutorial-Unix programming tools (5)

Source: Internet
Author: User

Unix shell

This section summarizes most of the commands used in Unix shell.

FILE command

CDDirectoryChange the path. IfDirectoryIf not specified, the home directory is returned.

PWD displays the current path.

Ls displays the contents in the directory. ls-A displays the files starting with a vertex, LS-l displays the information of each file, and LS-T sorts the files according to the usage frequency.

RmFileDelete an object

MVOld NewRename the old file to new (also used to move files between Directories ). If a file named new already exists, it will be overwritten.

CPOld NewCreate an old copy and name it new. If there is already a file named new, it will overwrite it.

MkdirNameCreate a directory.

RmdirNameS to delete the directory. The directory must be empty.


Stenographer and wildcard

. Current directory.

.. Parent directory.

~ /Cs107 home directory cs107 directory.

~User userHome Directory.

* Represents any number of arbitrary characters (excluding '.'). For example, *. C is all files ending with. C.

? Any character (not including '.').


Other commands

CatFilePrint the file content in the standard output.

MoreFileSimilar to CAT, but only one page is printed at a time (useful when displayed ).

LessFileSimilar to more, but there is a slide bar. (Less or more)


W. view the user on the system and view what they are doing.

PS displays all processes (process IDs are used to kill processes ).

Jobs displays pending processes.


Program& Run the program in the background.

CTRL-Z hangs the current program.

% Return to the previously suspended program, or use the FG command (foreground ).

%NumberContinue a specified program (run the jobs command to view the program number ).


KillProcess-IDEnd a process.

Kill-9ProcessForce Process Termination.


GrepExp filesSearches for an expression in a series of files.

WCFileCalculates the number of words, lines, and characters in a file.

The script records all running commands and exits with the exit command.


LPRFilePrint with the default printerFile.

LPR-PinkyFilePrint with inky printerFile.

DiffFile1 file2Displays the differences between the two files.


TelnetHostnameLog on to another computer

SourceFileRunFile.


Get help

ManSubjectRead the manual for something.

Man-K Keyword: displays the page about keyword.


History

History displays recent commands.

!! Execute the last command (or use the up arrow in the high-end shell ).

!NumberThen execute a specific command.

! String and then execute the last command. And starts with string.

^ Wrong ^ rightThen execute the last command and runRightSubstitutionWrong.

CTRL-P displays the commands run earlier.


MPs queue

A> B redirects the standard output of A to B.

A> B adds the standard output of A to B.

A> & B overwrites the error information of A to B.

A <B redirects the standard input of A to B.

A | B redirects the standard output of a to the standard input of B.



Translation thoughts:

This document was obtained by chance when I was looking for an open course in a foreign country. I used the commands and tools mentioned in this article to try it out.

I have been playing Ubuntu for two or three years, but many of the things mentioned in this article have never been touched. It's a bit embarrassing to say ....

I learned a little technology, learned a little English, and shared knowledge. It's good !!!

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.