LINUX study notes day2

LINUX study notes day2

Today is the second day of training to learn Linux is also the last day, but today issued the day before the exam answer sheet java, emm, to test the very poor, and my heart score and the actual score gap between non-poor large, I learned of java before I feel deep deep guilt ,, paid so much time. . . Hey

Metacharacters

Yuan characters: characters have special meaning, you can substitute other characters.

1) represents the home directory ~

2) * matches zero or more characters

cd
mkdir test
cd test
Touch a.txt b.txt ab.txt ab abc a bc
query test directory that begin with a file?
ls a
query test directory with txt file with the extension?
LS
.txt
delete files that begin with b?
rm b *

3)? Matches a single character (and there is only one character matches)

Directory inquiry test for the second character b file?
ls? b *
query test file to a directory beginning with file name length is 3 characters?
ls a ??

4) [] matches a single character from a set of characters

touch link1.txt link2.txt n.txt k.txt
ls [link].txt
ls link.txt
ls [b-fB-F]*.txt

5); a plurality of connection commands

cd /; LS
DATE; CAL; pwd
DATE: Display Time
cal: Displays the current month's calendar
cal 4 2014: April 2014 show calendar
cal 2014: 2014 calendar display

6) |: the pipe connector

After the output of the previous command as a command input
LS the -l / etc | More
More / etc / passwd
More: split-screen display, the screen displays a one-time

7)>,<,>>

: Redirect the output to a file, overwriting the contents of the file.
. 4, 2014 CAL> test.txt
CAL 10, 2014> test.txt

: Redirect the output to the contents of the file, the additional file.
7 2013 >> test.txt CAL
<: Redirect input file to the
cat: the default input is the keyboard
interrupt process: Ctrl + c
CAT <test.txt
CAT <test.txt> a.txt
equivalent to ---> cp test .txt a.txt

8)cat

a) shows the contents of the file to the screen, to show all the contents of the
cat may be a plurality of content files
b) splicing a plurality of files into one large file
cat / etc / the passwd
cat / etc / the passwd / etc / Group
cat / etc / the passwd / etc / Group> Cat.txt
CAT / dev / null> Cat.txt
CP / etc / the passwd / dev / null
Note: / dev / null unix black hole is
generally the / dev / null empty as other documents.
Empty files can also be used:> Cat.txt
: indicates no task operation
cat / etc / passwd | awk -F : '{print $ 1 "\ t" $ 6}' | sort> ~ / userinfo

in units of word processing awk
-F specified delimiter
 ULink
sort ordering

9) more: split-screen display file contents

More / etc / passwd / etc / Group
H: display help information

vi editor

vi editor: command line editor, using only the keyboard, without using the mouse.
Format: vi filename
three modes:
Command mode: No typing, can only use the command, enter the default mode of the vi
input mode: You can enter the contents of
the bottom line mode: the cursor on the bottom line, save the file as
a command mode switching input modes:
I: inserted at the cursor position in front of
I: rows inserted into the cursor line first
a: inserted at the cursor position behind the
a: rows inserted into the cursor line first
o: is inserted into the cursor line the next line
O: cursor line is inserted into the line
input mode switching command mode: ESC
command mode:
moving the cursor: the hjkl
delete the text:
X: delete a character
dw, 2dw, 3dw ..: how many words deleted
dd , 2dd, 3dd ...: delete how many rows
: 3,5d: delete line 3 to line 5
replace text: rewrite
r: replace a character
cw: replacing a word
cc: replace line
C: replace from the cursor to the line tail
copy and paste:
P: this next line paste
P: line current on line paste
yw: copy word
yy: copy line
Y: copy line
: 3,6co9: 3 to copy rows 6 rows after row 9
: 3,6m9: Mobile Line 3 to Line 6 to 9 line after
save and quit:
: w save the file does not quit
: wq save and exit
: q forced to quit without saving!
: W newfile saved as a new file
-level commands:
U: Undo , to undo the last save point
: set nu set the line number
: set nonu cancel line numbers
: 1, $ s / hello / world / g of replacement text Hello -> World
: 10,20s / Hello / World / replacement of G 10 to 20 rows
:% s / hello / world / g full replacement
%: Representative entirety
$: represents the file at the end of
the command mode is switched bottom mode:
:
?
/

Initialization file

Initialization files can do initial configuration information to the system.
The most important information is to configure the system environment variables.
Generally it refers to an environment variable to specify the operating system running in the operating system environment
parameters, such as: temporary directory location directory location systems, third-party applications
location of the software and so on.

Temporary and permanent, such as PS1 = Briup%

1. initialization file

System-level initialization file:
For all users have effect.
/ etc / profile
user-level initialization file:
Effective for one user.
~ / .bashrc

2. How to set environment variables

$ Is a reference to an environment variable echo is to print the contents of
the environment variable environment variable value =
VAR1 = the Hello
echo $ VAR1

= VAR3 date
``: Take command of the results
echo $ VAR3

3. It is important PATH environment variable

Environment variables: the search path specified executable files (from left to right search,
commonly named the best path configuration on the far left)
echo the PATH $
ls cd pwd
Which ls ls command to view the path from the path to find the
whereis ls from the entire Find files

Modify PATH =.
View ls, clear command if you can find

4.alias, PS1

show all aliases alias
alias copy = 'cp -l' alias the
unalias copy: copy revocation Alias
modified prompt: PS1 = "test $"

5. In the initialization file modification, preferably prior to the change to the initialization file backup, the user-level initialization file modified prompt:

~ CP / .bashrc ~ / .bashrc.bak
VI ~ / .bashrc
G
O
PS1 = "$ Test"
Alias H = History
: WQ
apply the changes:
The first embodiment: closed terminal, a terminal restart the
second embodiment : source ~ / .bashrc

umask: umask
default permissions to the directory: 777-umask value is
the default file permissions: After 777-umask value, remove execute permissions

umask 002
777

002

775

111

664

其他命令
w
who
whomai
who am i
id
ps
ipconfig ifconfig

Guess you like

Origin www.cnblogs.com/sm1128/p/10945642.html