linux-Basic Command Test (i)

Source: Internet
Author: User

1. withRootUser LoginLinux, create a directory/perm, in/permcreate file under directoryNewFile, Grant/permDirectory all users haverwxpermissions; Create a normal usertestuser, switch totestuserExecution "Rm/perm/newfile"Is it possible to perform

[[Email protected] ~]#[[email protected] ~]# mkdir/perm[[email protected] ~]# Touch/perm/newfile[[email protected] ~]# C Hmod 777/perm/newfile[[email protected] ~]# ls-l/perm/newfile-rwxrwxrwx. 1 root root 0 April 04:57/perm/newfile[[email protected] ~]# useradd testuser[[email protected] ~]# passwd Testuser[[emai L protected] ~]# su testuser[[email protected] perm]$ RM newfile

RM : Delete plain empty files with write protection "NewFile" ? y

OK

2. in the/rootcreate file under directoryNewfile2, move filesNewfile2to the/permdirectory under the same name asfile01; Change/perm/file01the owner of the file is the system userADMTo change the group that belongs to the System user group Games; Change/perm/file01file permissions are "rwxrw-r--"; in/permdirectory, respectively, tofile01generate a soft link fileFile01.softand a hard-link fileFile01.hard; Delete/permCatalogue

[[email protected] ~]# touch newfile2[[email protected] ~]# mkdir / Perm[[email protected] ~]# chmod 777 /perm/[[email protected] ~]# mv  newfile2 /perm/file01[[email protected] ~]# chown adm /perm/file01 [[ email protected] ~]# chgrp games /perm/file01 [[email protected] ~]#  ls -l /perm/file01 -rw-r--r--.  1 adm games 0 4 Month   21  05:09/perm/file01[[email protected] ~]# chmod 764 /perm/file01 [[email  protected] ~]# ls -l /perm/file01 -rwxrw-r--.  1 adm games 0  4 Month   21 05:09/PERM/FILE0[[EMAIL PROTECTED] ~]# LN -S /PERM/FILE01 /perm/file01.soft[[email protected] ~]# ln  /perm/file01 /perm/file01.hard[[ email protected] ~]# ls -l /perm/Total dosage  0-rwxrw-r--.  2 adm games  0 4 month    21 05:09file01-rwxrw-r--.  2 adm games  0 4 Month   21  05:09file01.hardlrwxrwxrwx. 1 root root  12 4 Month   21 05:14  File01.soft ->/perm/file01[[email protected] ~]# rm -rf /perm

3. View/ etcdetails of the directory (permissions, size, etc.);/etc/The details of the file under the directory, the paging/ etcDirectory Search5files that have been changed within minutes;/ Bootdirectory to find the file namedgrub.confFile and also list the details of the filein the root directory, locate the system that is larger than100MBless than150MBof the file

[[Email protected]~]# ls-l/etc/| More[[email protected]~]# find/etc-ctime-5[[email protected]~]# Find/-size +100m-a-size-150m[[email protected]~]# Find/boot-name grub.conf/boot/grub/grub.conf

4, to see if the system is installedPHPa software package;grepViewApacheconfiguration file/etc/httpd/conf/httpd.confof theDocumentRootoption information; tree-like display/etc/httpdfile structure under directory

[email protected] ~]# Cat Install.log | grep php[[email protected] ~]# cat/etc/httpd/conf/httpd.conf| grep documentroot[[email protected] ~]# tree/etc/httpd

5 , view user Profiles /etc/shadow 's help information; View Commands CD The Help information

[[email protected] ~]# Man/etc/shadow[[email protected] ~]# man--help

6, create a directory/comp, copy files/etc/servicesto the/compdirectory, respectively, theServicesfiles are compressed and generated. gz. zip. bz2three-format compressed package; copy Directory/ etcto the/compdirectory (keep directory attributes unchanged),etcDirectory compression Generationetc.tar.gz, putServicesall compressed packages for files are usedRMDelete (with only oneRMcommand, not executed three timesRMoperation);/compcreate file under directoryHidefile, and set to hide

[[email protected] ~]# cp -a /etc/services  comp/[[email protected] ~]# zip –r comp/services.zipcomp/services[[email  protected] ~]# gzip -r comp/services[[email protected] comp]# bzip2  services[[email protected] ~]# cp -a /etc comp/[[email protected] ~]#  tar -cvf comp/etc.tar.gzcomp/etc[[email protected] ~]# rm -rf comp/ Services.* 

7 , find commands ifconfig the absolute path and determine which users of this command can execute; Change native IP address is 192.168.9.250 (change back after practice)

[[email protected] ~]# Whereis ifconfigifconfig:/sbin/ifconfig/usr/share/man/man8/ifconfig.8.gz[[email protected] ~] # ifconfig Eth0 192.168.9.250255.255.255.0

8 , Ping native address test, request send Ten Times ICMP package and the package size is + byte

[[email protected] ~]# ping-c 10-s 1000192.168.216.1589, set command "CP-RF" command alias to DIRCP, view current online users [[email protected] ~]# who

Ten , view / etc directory under file name to . conf the end of the binary file has the number of

[Email protected] ~]# find/etc/-name "*.conf" | Wc-l



This article is from the "Wu-Dick" blog, please be sure to keep this source http://9827789.blog.51cto.com/9817789/1659870

linux-Basic Command Test (i)

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.