Learn shell-1

Source: Internet
Author: User

1. Using securitycrt in the options-> session Options dialog box, there are many options for emulation under terminal. the Linux server has different terminal simulation packages called the terminfo database, each type corresponds to a terminfo File

 

You can use the terminfo command to view the content. The specific meaning of the content is to be checked. It is mainly about how to display the text and window configuration information.

[admin@v035114 ~]$ infocmp ansi  #       Reconstructed via infocmp from file: /usr/share/terminfo/a/ansiansi|ansi/pc-term compatible with color,         am, mc5i, mir, msgr,         colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,         acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,         bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J,         cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B,         cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,         cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P,         dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,         el1=\E[1K, home=\E[H, hpa=\E[%i%p1%dG, ht=\E[I, hts=\EH,         ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J,         indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcbt=\E[Z, kcub1=\E[D,         kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L,         mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, op=\E[39;49m,         rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rin=\E[%p1%dT,         rmacs=\E[10m, rmpch=\E[10m, rmso=\E[m, rmul=\E[m,         s0ds=\E(B, s1ds=\E)B, s2ds=\E*B, s3ds=\E+B,         setab=\E[4%p1%dm, setaf=\E[3%p1%dm,         sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,         sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, smso=\E[7m,         smul=\E[4m, tbc=\E[2g, u6=\E[%i%d;%dR, u7=\E[6n,         u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd, 

View which Terminal Simulated package is used

[admin@v035114 ~]$ echo $TERMlinux

 

When using securitycrt to connect to the server, you can only use the command line. In fact, there is also a gnome graphic terminal simulation package, and I don't know how to use it.

2. File System shell commands

1. View File and stat attributes.

[admin@arch036088.sqa.cm4 bin]$ file *end.sh:     Bourne-Again shell script text executablejavaHome:   ASCII textserver.pid: ASCII textserver.sh:  Bourne-Again shell script text executabletask.sh:    Bourne-Again shell script text executable[admin@arch036088.sqa.cm4 bin]$ stat task.sh   File: `task.sh'  Size: 3359            Blocks: 8          IO Block: 4096   regular fileDevice: fd02h/64770d    Inode: 2916501     Links: 1Access: (0755/-rwxr-xr-x)  Uid: (  500/   admin)   Gid: (  500/   admin)Access: 2012-08-08 16:27:23.000000000 +0800Modify: 2012-07-17 16:47:52.000000000 +0800Change: 2012-07-17 16:47:52.000000000 +0800

2. View File Content

Cat reads all the content at once,-N displays the row number, and-B only displays the row number of the non-empty row table.

CAT has three main functions:
1. display the entire file at a time. $ Cat filename
2. Create a file from the keyboard. $ Cat> filename can only create new files and cannot edit existing files.
3. Merge several files into one file: $ cat file1 file2> File

Clear File Content

cat /dev/null > file 

More press the Space key to flip the screen

Less is more powerful

Tail and-F can be used to view the latest and last lines of-n.

The head is rarely used. You can use the first screen more.

3. File Operations

CD change dir change Directory

CP copy-r iteration directory-P with attribute copy-F force overwrite existing target file; Use-L to create hard link

Rm delete file-r-F

Ls-l display list,-I display inode,-A Show Hidden Files

MK File Creation

Mkdir: Delete the directory. You can use RM to delete the directory.

Touch creates a file, modifies the file modification and access time

Mkdir create directory

MV mobile files and directories

4. Input and Output

Linux uses the file descriptor (FD) to identify the file object, which is a non-negative integer. A process can contain a maximum of nine file descriptors.

Input redirection: Get cat input through a file

[admin@v035114 shell]$ cat < nihao this is a test line

Output redirection: a greater than ID is created (if it does not exist), overwritten (if it exists), and two greater than Id indicates append

[admin@v035114 shell]$ who > test1[admin@v035114 shell]$ date >> test1[admin@v035114 shell]$ cat test1 admin    pts/3        2012-08-22 21:47 (10.13.43.86)admin    pts/7        2012-08-24 11:34 (10.13.43.86)Sun Sep  2 10:56:35 CST 2012

Redirection error: Add stderr's file descriptor 2 to the front of the file.

[admin@v035114 shell]$ ls -al badfile 2> test[admin@v035114 shell]$ cat testls: badfile: No such file or directory

Redirect data and errors:

[admin@v035114 shell]$ ls -la test1 badfile 2> test 1>nihao [admin@v035114 shell]$ cat testls: badfile: No such file or directory[admin@v035114 shell]$ cat nihao -rw-rw-r-- 1 admin admin 135 Sep  2 10:56 test1

Redirect data and errors to a file: &>

[admin@v035114 shell]$ ls -la test1 badfile &>nihao          [admin@v035114 shell]$ cat nihao ls: badfile: No such file or directory-rw-rw-r-- 1 admin admin 135 Sep  2 10:56 test1

 

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.