This is three days of Linux learning notes, the great God can advise, do not squirt me, I novice.

Source: Internet
Author: User
Tags create directory first string gz file unpack

20140825. Study Notes
Open new Terminal ctrl+shift+n
Close Terminal Alt+f4
Expand Terminal ctrl+shift+ "+"
Reduce the terminal Ctrl + "-"
Open a new Terminal tab ctrl+shift+t
Close the Terminal tab ctrl+shift+w
Toggle between labels ALT + label corresponding number
Switch to real terminal tty3 CTRL+ALT+F3
TTY back to graphics alt+f1 or F7

Shortcut key Settings
Terminal---> Edit---> Keyboard shortcuts

Set the terminal font color
Terminal---> Edit---> Write-side Preferences

Shutting down the firewall
Iptables-l Querying firewall rules
Iptables-f Clear Rules
Service iptables Save rule

Turn off SELinux (Security enhanced components)
Setenforce 0
Gedit/etc/selinux/config
Elinux=disabled

View notes
Ftp://172.16.10.1/

Download notes
Location----> Connect server----> enter IP address----> Connection

Connect to Remote Desktop
Vncviewer 172.16.10.1


Basic commands
command [parameters] .... [File] ....
Ls-l Install.log
LS Displays all file names in the current directory
LS-LH Mate L shows the current file permissions and size
-#rw-r--r--#. #1 #root #root # 69835 #8月 #install. Log
File type # Basic permission bit # The file is created # # hard Links # # file owner # File owning Group # File size (bytes) #最后一次修改时间 # filename

Seven Types of files
-File Plain files
D Directory files
L Symbolic Symbolic Link file
B Block Blocks device files
C CharSet character device file
P Pipe Piping File
s socket socket file

LS-L long format Display-a displays all files-a displays except. and. All files except the current directory: Upper Directory-D display directory information--------------by time------sort
-s sort by file size

Practice:
1. Check out what type of/etc/passwd is a file? /dev/tty3 What type/DEV/SDA type?
2. Total number of files (including hidden files) in/boot directory
3. View the size of the/etc/man.config file
4. Operation of other parameters

Cd
Absolute path: Path starting from/directory///var
Relative path: var vs. path to current directory

PWD shows where you're currently located

cd/var/log/~ Home Directory CD ~ CD.  Cd.. Cd..  /.. CD-returns to the last working directory
PWD Displays the current directory
Cd/var/log


20140826. Study Notes
Get help with LS--help
1.ls--help
2.info ls
3.type ls
4.alias la= "Ls-l" production alias Note: Do not save, only in the current terminal effective
5.man corresponding command
Man LS view how to use LS command
Man 1 user Command *
Man 2 system call
Man 3 Library Call
Man 4 Special files
Man 5 config file *
Man 6 games
Man 7 Miscellaneous
Man 8 system Commands *
Man-f shown in those chapters has the corresponding to the description
Makewhatis
Man-k passwd | grep--Color passwd fuzzy query
/follow directory to directory function
/bin/usr/bin/usr/local/bin User Executable Directory
/sbin/usr/sbin/usr/local/sbin System Executable Directory
/lib/usr/lib/usr/local/lib Library files/directories (library files and module files)
/LIB64/USR/LIB64/USR/LOCAL/LIB64 64-bit library file directory (library files and module files)
/USR program directory
/dev Device file directory
/etc configuration file directory
/var server data Directory
/Boot bootstrapper directory (boot, kernel, boot file)
/root Root Administrator home directory
Home directory for all ordinary users
/tmp Temporary files directory (scheduled tasks, installation software,) timed cleanup does not execute files
/proc pseudo File system (memory information mostly, process information, hardware information)
/sys pseudo File System (memory information, process information, hardware information)
/cgroup Resource Management
/OPT Third party software catalog
/mnt Other mount points
/media Media Directory
/misc/net AutoFS Services used in the directory
/selinux selinux Security Enhancement Component Usage Directory
/SRV Service Data Catalog
/lost+found
View File Contents
Head default view file contents to the first 10 lines
Head-n 20 Viewing the file contents to the first 20 lines
Tail default view end 10 lines
Tail-n 30 View End 30 lines
More Install.log
Space PAGE Down
Carriage return down move
b PAGE Up
Q exit
Less
Example: Less Install.log
Cat browses a file on the terminal
Example: Cat-n install.log
Cat-n Install.log | Less
Cat-n Install.log | head-50 | TAIL-1 View results of Install.log line 50th
Touch Create File
Touch Tt.txt
Touch Xx.txt Yy.txt
Touch Abc{1..10}.txt
Touch {A,b,c}{1..3}.txt
mkdir Creating a Directory
mkdir abc{1..3} Create an ABC three directory
Mkdir-p file name Recursive creation
MKDIR-V Display creation Process
Practice:
1. Enter the TMP directory to create the test directory
2. Under the/tmp/test directory, create 100 files and 100 directories
Mkdir/tmp/test
Touch/tmp/test
Copy files
Cp
cp/root/install.log/tmp/copy Install.log to/tmp
cp/root/install.log/tmp/test/Copy and rename
Cp-r recursive copies are copied together with the files to the file
Cp-r/root/install.log//tmp/zz
Cut files
MV source file Address destination address
Example:
Mv/root/abcf/tmp cut ABCF to/tmp
Mv/root/abcf/tmp/abch cut files and rename them
MV Yy.txt/tmp the relative path down to file cut to TMP
Mv/root/yy.txt/tmp/zz.txt
MV Tt.txt ppp.txt Renaming files
Practice:
Create a/tmp/dir directory
Mkdir/tmp/dir
Copy the/root/install.log file to the/tmp/dir directory
Cp/root/install.log/tmp/dir
Copy the/mnt directory to the/tmp/dir directory
Cp-r/mnt/tmp/dir
Cut/tmp/dir/install.log files to/tmp/dir/mnt
Mv/tmp/dir/install.log/tmp/dir/mnt
Delete
RmDir only empty directories can be deleted
Rm-rf-r recursive-F enforcement
RM-RF *.txt Delete txt file in all current directories
RM-RF abc* Delete the current directory to all start with ABC to directory
RM-RF * Delete all files under current directory (operate cautiously) do not execute under//root
Practice:
1. Create a directory structure (1 command creation)
/tmp/aa-Create ca/cb/in directory
Mkdir/tmp/aa/c{a-b}
2. Copy the/etc/man.config file to the CA and rename it to Test.txt
3. Move Test.txt to CB
4. Delete the Test.txt file
Vim Text Editor
VI Black and white text display
Vim with color font display
Command mode
> Enter input mode
Vim Aa.txt Press A to enter the input mode note: Each operation result input must press ESC to return
A current character followed by input
A current line end input
I current character before input
I current line input
o The next line of input for the current row
O Line input on the current row
U undo one-Step operation
YY Copy line P paste
3YY Copy 3 Rows
DD cut one line p paste
DD 750g
GG First Line
G-Tail Line
DGG delete from current line to first row
DG Delete current line to tail line
Ygg Copy from current line to first row
YG Copy from current line to tail line
ESC returns
Last-line mode
: W Save: Q exit: Wq Save and exit
: w! : q! : wq!! Force no prompt to save or exit
: 2,4w new2.txt Save
: E/root/new.txt absolute path to a file
: R/root/new2.txt reads a file in append
: e! Force open the current file
: Set Nu Sets line number
: Set Nonu de-set line number
/find string n next n prev
? A Find
: S/ab/xx/replaces only the first string to which the current line matches
:%sab/xx/replaces the current match to the first string of each line
:%sab/x/g replaces all current to AB string
: 2,5,/ab/x/g replace 2, 5 lines to string
: 2,5,/ab/x/gc substitution string asks if replace (interactive substitution)
d^ Delete the current character to the beginning of the line
d$ Delete the current character to the end of the line
y^ Copy the current character to the beginning of the line
y$ Copy the current character to the end of the line
% each line s replaces G Global C Interactive
^ Beginning $ line End
ESC returns
Practice:
1. Add a # number to the front of each line
:%s/^/#/
2. Replace All rows with *
:%s/^.*$/*/
3. Delete all the spaces in the file
:%s///g
4. Delete the space at the beginning of the file
:%s/^ *//g
5. Replace all spaces in the file with a tab \ t
:%s//\t/g
6. Merge all the rows in the file into one line \ n
:%s/\n//

Vimtutor Vimtutor Tutorials

20140827. Study Notes
User Management
PTS Shell
Shell command interpreter
SUSE Linux
Nologin Non-interactive shell
Id
UID User Information
GID Master Group
Group additional groups
User groups
Root uid=0 (Manage exclusive UID) root gid=0
System User uid=1-499 System group gid=1-499
Ordinary user uid=500-60000 General user group gid=500-60000
Add Account command
Useradd
Account File/etc/passwd
Raobin:x:501:501:/home/robin:/bin/bash
User name: Password placeholder: uid:gid: Description Information: Home directory: Shell
Password occupancy: x Delete x is empty password
Useradd-u 550 User1 UID
Useradd-u 551-g Oracle User2 GID
Useradd-u 552-g oracle-c Hello user3 description information
Useradd-u 553-g oracle-c hello-d/tmp/user4 user4 Home Directory
Useradd-u 554-g oracle-c hello-d/tmp/user5-s/bin/tcsh user5 Shell
Add Group command
Groupadd
Groupadd Upup
Group configuration file/etc/group
upup:x:551:
Group name: Password placeholder: gid:[user Name]
Groupadd-g Kevin
Userdel Deleting a user name
Userdel-r King R Recursive Delete
passwd Change Password
PAASWD King Modify a specific user password
A specific user who modifies a password in user logon mode needs to verify the current password
Practice:
Add group KKK GID is 2000
Groupadd-g KKK
Add User King UID 2000 belongs to KKK group description for Linux home directory under/mnt Shell for bash
Useradd-u king-g kkk-c linux-d/mnt/king-s/bin/bash
Su-king Test after adding complete
Su-king
Password to config file/etc/shadow
King:$6$v.9gnriu$nm.djii/iaeh8c.az206citwhjqx2v7s7r5s1a5/miqq7lje/x1fjjnhd7r0u5.s7nsfnyatvlqb1n1c26iaw. : 16309:0:99999:7:::
First column: User name
The second column: Password has password!! Password Lock * This account is permanently unable to log on to the system
Modify Account
Groupmod-n Modifying group names
Groupmod-n Newupup Upup
Groupmod-g modifying GID
Groupmod-g Newupup
Usermod Modifying user information
Usermod-u-g-c-d-s User name
usermod-d/home/user5 User6 (Move the original home directory to the user directory to now change to the directory home directory)
Usermod-l Modifying a user name
Usermod-l Lock User
Usermod-u Unlocking users

Change the password to use some parameters
Passwd-s Password Status
Passwd-l Lock Password
Passwd-u Unlock Password
Delete User
Userdel-r Recursive deletion
Delete a group
Groupdel (the group member must be removed or changed to another group before deleting the group)
Permissions
CHGRP: Changing the group to which the directory belongs
Chown: Changing the directory Owner
chmod: Change the permissions of the directory, SUID, SGID, Sbit and so on special despair
Ls-l Install.log
-rw-r--r--. 1 Robin uplooking 69835 August 21:03 Install.log

rwx | rwx | Rwx
User group Other
Robin Uplooking
U g o
Aa.txt rw-|r--|---Jack Upup

Jack
Zorro upup
Jack Upup

Root---------Jack-----upup------Other
U (user) = Users
G (Group) = User Group
O (Other) = others
A (all) = All users
For file
Readable R (Read)--------cat head more less tail
Writable W (write)-------vim gedit > >>
Executable x (EXEC)--------./(relative)/root/test.sh

For directory
Readable R (read)--------LS r-x
Writable W (write)-------Touch rm-wx can only delete known files rwx rm-rf *
Executable x (EXEC)--------CD
echo output to terminal or text display
> Coverage
>> Append
/test/rwxrwxr-x root root
Aa.txt rwxrwxrwx Root root
Robin

/test/rwxrwx---root root
/TEST/AA/RWXRWXRWX root root
/test/aa/aa.txt rwxrwxrwx Root root

Robin

Modify Permissions
chmod u+r File/dir
chmod u+r,g+w File/dir
chmod U+R,G-W,O+RW File/dir
chmod ug+rw,o-r File/dir
chmod ugo+rwx File/dir
chmod a+rwx File/dir
(= Clear all permissions, set permissions directly)
chmod u=r File/dir
chmod u=r,g=w File/dir
chmod U=R,G=W,O=RW File/dir
chmod ug=rw,o=r File/dir
chmod ugo=rwx File/dir
chmod a=rwx File/dir
Practice:
1./tmp creating files Aa.txt requirements:-wx--xr--
Chomod u-r,u+x,g-r,g+x Aa.txe
chmod u=rx,g=x Aa.txt
2./TMP Create file Tt.txt requirements: The owner can read the owning group can write other people per permission
chmod u=r,g=w,o=-Tt.txt
3./tmp/Create directory YYY requirements: The owner can delete all files that belong to the group without permissions other people can read the file name under the directory
chmod u=rwx,g=-,o=r yyy/
4. Query the following file permissions and remember
/r-xr-xr-x readable executable-readable executable-readable executable
/etc/rwxr-xr-x readable writable executable-Executable writable-Executable
/usr rwxr-xr-x readable writable executable-executable readable-executable
/tmp RWXRWXRWT readable writable executable-readable writable executable-readable writable executable
/root/r-xr-x---Readable-executable readable-executable
/home/robin rwx------Readable writable executable-no permissions-no permissions
/etc/passwd rw-r--r--readable and writable-readable-readable
/etc/shadow---------No permissions-no permissions-no permissions
Number Representation permission algorithm
R==============4
w==============2
X==============1
R-X--X-WX 513
123--X-W--WX
Owner to owning group
Aa.txt rwxr-x---Kevin Root
Chown Modifying Owner Permissions
-R Recursive modification
CHGRP Modifying the owning group
Kevin
. =:(Modify user groups at the same time can be used instead)
Chown-r robin:uplooking test/
Chmod-r 777 test/
Practice:
1.root User created file/tmp/test.txt
Requirements: Robin can read and write to Test.txt uplooking Group may be reading Test.txt file Other people do not have permission
Chown-r robin:uplooking/tmp/text.txt/| chmod 640/tmp/text.txt/

2. Create the Dir directory under the/tmp directory to create the Xx.txt file in the dir directory
Requirements: Robin users can read and write xx.txt files but cannot delete xx.txt files
Zorro users can not read and write xx.txt files but can be deleted.
/tmp/dir/rwxr-xr-x Zorro Root
/tmp/dir/xx.txt rw-r-----Robin Root

Robin
Zorro

Chown Robin/tmp/dir/xx.txt
chmod 640/tmp/dir/xx.txt
Chown zorro/tmp/dir/
Mkdir-p Dir/xx.txt
Chown Robin/mnt/dir/xx.txt | chmod 640/mnt/dir/xx.txt | Chown zorro/mnt/dir/
3. Assign permissions as required below.
A company has a financial statement file Cw.txt assign permissions to the following 3 categories of employees
1.boss
2. Finance Department Staff
3. Other employees
Cw.txt R--RW----Boss CW


Aa.txt------RWX Boss KKK
Boss
Yg
GROUPADD-G 8888 CW
Useradd-u 9999-g cw-d/tmp/boss/-s/bin/bash boss
Useradd-u 6666-g kkk-d/tmp/yg/-s/bin/ksh YG
Chown-r BOSS:CW cw.txt/| Chown-r BOSS:KKK Aa.txt
chmod 460 cw.txt/| chmod 007 Aa.txt


Process Management
Executable program, daemon
is generally static query
Ps-ef
PID Process ID Number
TTY down to? No reliance on terminal boot to process
UID User start owner
PID User Process ID number
Ppid Parent-Child process ID number
C Use CPU to percent
Stime Start-up time
PS A shows all running to the process on the terminal
Ps-u Users
Ps-x All Processes
VSZ Virtual Memory
RSS Real consumes the memory unit K
Top
Kill-9 PID
Pkill httpd Process name Chen all related process name Chen PID all kill no return status
Killall HTTPD has returned to state
Xkill skeleton Kill method:) existed before Redhat6

20140827 Study Notes
Top
Tasks Process Group

Sleeping sleep
Stopped stop state
Zombie Zombie Process
PR-Priority
Virt Virtual Memory
Res Real Memory
SHR Shared Memory
Front and rear switch
Xclock-updata 1 &

Xclock-update 1
CTRL + Z switches to the terminal and mounts the process to hibernation
Jobs query Background Run process
BG number to Background
FG number to foreground
Kill% number kills background process

Compress command
Compress command
Gzip bZIP bzip2 can only compress files
DD If=/dev/zero of=/root/data bs=100m count=2
Input and output block size
Du-sh/root/data Viewing file sizes
Gzip/root/data Compressed Files
Bzib2/root/data Compressed Files
Unzip
Gunzip/root/data.gz Extract files with gzip
bunzip2/root/data.bz2 extracting files with bzip2
Video. Audio, picture, cannot be compressed with compression commands.
echo $ ((1024*120/40/60)) =51 calculation
Packaged
TAR-C Create v packing process F file t query R append x unpack
Z Call gzip Command J Call bzip2 command C develop path decompression package
TAR-CVF boot.tar/boot/(only packaged, not compressed)
TAR-TVF Boot.tar View Package to file information
Tar rvf boot.tar/root/data Append the file to the current package
TAR-XVF Boot.tar Unpacking Command
tar-cvf/tmp//boot/Packaging Development Directory
Tar-xvf/root/boot.tar-c/tmp/unpacking and making directory

tar-zcvf/tmp/boot.tar.gz/boot/using the TAR command to call gzip package and compress files
Tar-ztvf/tmp/boot.tar.gz using the tar to call the gzip command to query the tar.gz file
Tar-zxvf/tmp/boot.tar.gz-c/tmp/developing the unpacking path

tar-jcvf/tmp/boot.tar.bz2/boot/call bzip2 to develop a path to package and compress
TAR-JTVF/TMP/BOOT.TAR.BZ2 calling bzip2 query tar.bz2 file with the tar command
Tar-jxvf/tmp/boot.tar.bz2-c/tmp/Use the tar command to call bzip2 to make the path decompression and unpack the package

Tgz tbz2

Install package
Mount Mount
Mounting discs
MOUNT-T iso9660/dev/cdrom/mnt/Mount CD img file
Mount Query Mount Information
Umount/dev/cdrom or umount/mnt unload mount point
Mount img
Mount-o loop/var/ftp/***.iso/mnt/
Mount/var/ftp/rhel-server-6.4-x86_64-dvd.iso
Umount-l/mnt forced uninstallation in the directory
Umount/var/ftp/rhel-server-6.4-x86_64-dvd.iso
Cd. Refresh Cache
Umount
Server Package
Cluster cluster software
Clusert Storage Cluster Package
VT Virtualization Package
RHEL5
Packges All Packages
Server Package
HA High Availability Cluster
LoadBalancer Load Balancing cluster software
Storage storage Software
FS File system software
RHEL6
Installing the Software
Rpm-i Install-V installation process information-h percent-e unload L list show f file
RPM-IVH httpd-2.2.15-26.e16.x86_64.rpm
Rpm-q httpd query httpd installed or installed successfully (with return package information installed successfully)
Rpm-e Gnome-user-share
The installation cannot be made by default to some libraries and packages and is not supported by the function used to
RPM-QL httpd query Software Installation location directory
Rpm-qa | grep--color httpd Query when installing to all software filtering
Rpm-qf/etc/man.config query command to installation directory and installation package
RPM-QF ' which nmap ' command if not, query installation
The solution of the dependency relationship
[Email protected] packages]# RPM-IVH httpd-devel-2.2.15-26.el6.x86_64.rpm
Warning:httpd-devel-2.2.15-26.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
error:failed dependencies:
Apr-devel is needed by httpd-devel-2.2.15-26.el6.x86_64
Apr-util-devel is needed by httpd-devel-2.2.15-26.el6.x86_64

RPM-IVH apr-devel-1.3.9-5.el6_2.x86_64.rpm
RPM-IVH expat-devel-2.0.1-11.el6_2.x86_64.rpm
RPM-IVH apr-util-devel-1.3.9-3.el6_0.1.x86_64.rpm
RPM-IVH httpd-devel-2.2.15-26.el6.x86_64.rpm


Yum Library
1.mount/var/ftp/rhel-server-6.4-x86_64-dvd.iso/mnt/-O loop mount
2.cd/etc/yum.repos.d/Entering the catalogue
Touch Yum.repo create yum suffix file named repo
3.vim Yum.repo Edit new Create to Yum Library
[Rhel6-server] Yum name
Name=cdrom Source describes its origin
baseurl=file:///mnt/mount point Directory
Enabled=1 Open
Gpgcheck=0 whether the check
Yum clean all clears the Yum cache
Yum Makecache Create Yum Cache
Yum list shows Yum down to the package list
Yum Install Httpd-deverl installation software
Yum Remove removal Software (Note: If an error occurs, delete the existing directory under/etc/yum.repos.d/)

Scheduled Tasks
Service Crond Start
CRONTAB-E Edit-L query
* * * * *
The-week of time
Points (0-59)
Hours (0-23)
Day (1-31)
Month (1-12)
Week (0-7 0 and 7 are Sunday)
Date Current system time command
Restart Restart Service
Start Start service
* * * * * date >>/tmp/data.txt 1 times per minute
Ten * * * * Date >>/tmp/data.txt 10 minutes per hour
* * * * Date >>/tmp/data.txt 2 points per day 10 minutes of execution
5 8 * Date >>/tmp/data.txt every year to August 5 2:10
5 8 7 Date >>/tmp/data.txt every year to August 5 2:10 or every Sunday to 2:10
*/15* * * * Date >>/tmp/data.txt executed every 15 minutes
5,10,15,25 * * Date >>/tmp/data.txt daily 5,15,25 to 2:10
1-10 * * Date >>/tmp/data.txt executed every month to number 1-10.
Homework:
1. After 2 minutes of your system time, create the file under/tmp/test.txt
2. Add a user Jerry after 5 minutes of your system time and create a file in the user's home directory Aa.txt
3. After 3 minutes of your system time, copy the/etc/hosts file to/tmp
4. After 3 minutes of your system time, install the software dos2unix-3.1-37.el6.x86_64.rpm
5. After 6 minutes of your system time, save the/etc into a compressed package to/TMP
* * * */bin/touch/tmp/text.txt
* * * */bin/useradd-d/tmp/jerry Jerry | Touch/tmp/aa.txt

* * * * */bin/mv-f/tmp/aa.txt/tmp/jerry

* * * * */bin/cp-r/etc/hosts/tmp
* * * * * rpm-ivh/mnt/packages/dos2unix-3.1-37.el6.x86_64.rpm
* * * * tar-zcvf/tmp/etc.tar.gz/tmp/

Installing the software tree-1.5.3-2.el6.x86_64.rpm Q: What is the use of the tree command?

Create a directory/yum configure the Yum library on this directory
Install software vsftpd Uninstall VSFTPD


Run the program Vim/root/install.log in the background and move it into the foreground?

This article is from the "Infinite Wolf League" blog, please be sure to keep this source http://9935226.blog.51cto.com/8919044/1546300

This is three days of Linux learning notes, the great God can advise, do not squirt me, I novice.

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.