Unix commands for beginners

Source: Internet
Author: User
Tags ftp file uncompress ftp file transfer ftp file transfer protocol line editor
Classified communication of some LinuxUnix commands: ftp file transfer protocol login logs on to Unixmailx to read or send emails to rlogi

Summarizes the usage of some Linux/Unix commands.

Communication:

Ftp file transfer protocol

Login logs on to Unix

Mailx reads or sends emails

Rlogin logs on to remote Unix

Write talk to other terminals

Telnet to another system

Vacation automatically responds to emails

Comparison:

Cmp compares two files by byte

Comm compares entries in two sort files

Diff compares two files row by row

Diff3 compares 3 files

Dircmp comparison Directory

Sdiff compares two files side by side

File management:

~ Represents the user's home directory (yourhome directory)... represents the parent directory. represents the current directory

Cat connects to multiple files or displays them Ctrl + D. The input is as follows:Cat list1 list2> biglistWhatthis is doing is reading the contentsList1AndList2In turn, then outputing the text tothe fileBiglist

After the cd directory is changed, directly typing cd without the directory path will directly return to the user's working directory (this is very important when the user is lost in the file directory tree)

Chmod changes the file access mode

Copy a cp file, for example:CpFile1 file2Is the command which makes a copyFile1In the current working directory andcils itFile2

Csplit separates files at specific locations

File to determine the type of a file

Head: displays the lines starting with the file.

Ln creates an alias for a file

The ls list displays files or directories. when a user logs on to the system, the working directory is/home/user_name, where user_name is the user name. If you type ls separately, the preceding parameters are not included. is displayed, because. files starting with Unix are hidden and important. unless you are familiar with Unix, you are generally not advised to modify these files. Type ls-a to display all files (including files starting with.) ls-l

Create a directory using mkdir

More Display files on screen

Move or rename a file or directory

Pwd output working directory output the complete path of the current directory

Rcp copies files to a remote system

Rm delete File

Rmdir delete directory

Split splits multiple files evenly

Tail displays the last few lines of the file

Wc calculates the number of rows, words, and characters in a file.

Others:

Banner Display advertisement words

Bc calculator with arbitrary precision

Cal display calendar

Calendar detection memorandum

Clear screen

Man obtains the help information of a command.

Nice lowers the priority of a job

Nohup saves a running job after exiting the system

Passwd: set the system logon password

Script generates a copy of the login session

Spell reports misspelled words

Su becomes a super user

Print:

Cancel cancels a printer request

Lp sent to printer

Lpstat obtains the printer status

Pr format the printer content and edit the page number

Programming:

Cb C language source code optimizer

Cc C language compiler

Function flowchart of cflow C language

Ctags C language function reference (for vi)

Ctrace uses the C language debugger for function call tracking

Cross-reference of cxref C language

Lint C Language Program Analyzer

Ld loader

Lex lexical analysis generator

Make executes the command in the specified order.

Od dump input in different ways

Strip deletes data from a target file

Truss tracking signals and system calls

Yacc analysis program generator, which can be used together with the lex command

Search:

For example, enter less liao.txt and then run the command to stay in the less command. then, press enter/enter the content you want to search and Press q to exit the less command.

Extended version of the egrep grep command

Fgrep searches for files based on words

Find search system by file name

Gerp searches for files based on text format

Strings searches for binary files based on text format

Shell Programming:

Echo repeats command line parameters in input.

Expr performs arithmetic operations and comparison

Line

Printf format and print command line parameters

Sleep pause processing

Test a condition

Storage:

Compress files to free up space

Cpio copies the file to or from the disk

Gunzip uncompress (.gz and. z) files (preferred command)

Gzcat displays the content of the compressed file (which can be used with the zcat command)

Gzip compressed file to release Space (preferred command)

Tar tape archives can also uncompress. tar format files such as tar-xvf units-1.74.tar

Uncompress decompressed file (. z format)

Zcat displays compressed file content

System Status:

At then run the command

Group where the chgrp file is modified

Chown: modify the owner of a file

Crontab automatically executes the command

Date: Display or set the date

Df shows idle disk space

Du: displays disk space usage

Env display environment variables

Finger displays user information

Kill to terminate a running command

Ps display process

Set or display terminal devices

The user who displays logon appears to be able to display logon users only after entering whoami in cygwin.

Text processing:

Cut select columns to display

Ex vi line editor

Fmt makes the length of each line of text roughly the same

Join combines different rows into a database

New version of the nawk awk command (pattern matching language for text database files)

Combine columns or change the column sequence in paste.

Sed non-interactive text editor

Sort sorts or merges files. you can also sort command line input directly, for example, directly type sort. Sort List2 indicates that the content of list1 is used as the sorting input and then output to list2.

Tr conversion (redefinition) characters

Uniq searches for duplicate or unique rows in a file.

Vi visual text editor

Xargs processes multiple parameters in the manageable part

Compile the program source code to form the installation package:

The simplest way to compile a packageis:

  1. CdTo the directory containing the package's source code.
  2. Type./ConfigureTo configure the package for your system.
  3. TypeMakeTo compile the package.
  4. Optionally, typeMake checkTo run any self-tests that come with the package.
  5. TypeMake installTo install the programs and any data files and documentation.
Optionally, type Make cleanTo remove the program binaries and object files from the source code directory

Variable:

Generally, variables are divided into environment variables and shell variables. environment variables are generally in upper case, and shell variables are generally in lower case.

Example: % echo $ OSTYPE will return the operating system type

More examples of environment variablesare

USER (your login name)
HOME (the path name of your home directory)
HOST (the name of the computer you are using)
ARCH (the architecture of the computers processor)
DISPLAY (the name of the computer screen to display X windows)
PRINTER (the default printer to send print jobs)
PATH (the directories the shell shoshould search to find a command)

To show all values of these variables, type

% Printenv | less: the value of all environment variables is displayed.

Shell variable:

More examples of shell variables are

Cwd (your current working directory)
Home (the path name of your home directory)
Path (the directories the shell shoshould search to find a command)
Prompt (the text string used to prompt for interactive commands shell your login shell)

To show all values of these variables, type

% Set | less

Related Article

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.