Day 13th (Linux Common basic commands)

Source: Internet
Author: User

Create a new logical volume with the following requirements:
*) the logical volume is nameddatabase,belong todatastoreVolume Group.
*) in thedatastorelogical volumes in a volume group, 500M.
    *)Use{EXT3|EXT4|XFS}The file system formats the new logical volume
    *)The logical volume should be automatically mounted when the system is started/mnt/databasedirectory.
*) LVM expanded to1G,and retain the integrity of their original data;

Add a newSWAPPartitioning
    *) size is 512MB,
*) make theSWAPability to be active each time it is powered, and keep the originalSWAPPartitioning



#1. Disk Quotas(here the partition format is formatted asXFSformat)


##restrict the use of a user Block


##restrict a user's Inode




#2. Soft links and hard links

# #2-1. Create soft links with hard links




# #2-2. View File node number





# #2-3. the difference between a soft link and a hard link:
1). created in different ways:
Ln-s
ln
2). implementation features are different:
Soft Links:Shortcuts
        Hard Links:Backup

problem:can I make hard links across file systems??


#3. Linux Common basic Commands

# #3-1. Diff


# #3-2. grep: Text Search Tool
- N// Display matching content and line numbers
- I.// Case-insensitive search
- R// recursive search, followed by directory
- c// displays the number of matching keywords
- E// match multiple keywords, eg:grep-e ' root|student ' passwd
-V// Reverse Match
- c// displays the first and last lines of the matching row, eg:grep-c 3 root passwd

# #3-3. Sort
-t// Specify delimiter
- k// Specify a sorted column
- N// Pure Numeric sorting
- R// Reverse Sort
- u// Remove Duplicate Rows
Example:
Ls-s/etc | Sort-t ""-k1-nr | Head-10

# #3-4. awk ( Text Analysis Tools)

Example:
1). Show recently logged in5an account
Last-n 5 | Awk-f "" ' {print '} '
2). Find out besidesRootand theStudentof ordinary users
Grep-ve ' root|student '/etc/passwd |grep/home | Awk-f ":" ' {print $} '
3).
Ls-s/etc | Sort-t ""-K 1-NR |head-10 | Awk-f "" ' {print $} '

# #3-5. Uniq
-C
-U
-D

# #3-7. Sed
Sed ' s/root/westos/g ' passwd
Sed ' 1,5s/root/westos/g ' passwd
Sed-e ' 1,5s/root/westos/g '-e ' 6,12s/root/redhat/g ' passwd
Sed 1d passwd
Sed 1,3d passwd
Sed-f/mnt/rule passwd
Sed-i-f/mnt/rule passwd


VIM rules
@@
1 1d
2 1,3s/root/redhat/g
3 4,5s/root/westos/g
@@




















SED, awk, grep




























Day 13th (Linux Common basic commands)

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.