Linux file and directory management

1. Purpose of the experiment

Review the basics of Linux and review the basic commands of Linux. Familiar with basic commands such as Linux file and directory management, file content query, file permission query, and file search.

2. Experimental environment

Tool software: VMware

Experiment preparation: virtual machine ubuntu 14.04.6

3. Experimental content (experimental steps, test data, etc.)

1. File and directory management

(1) View the system root directory: ls / or first cd / and then ls

(2) Enter the /tmp directory, create a directory with your student number, and enter the directory

(3) Display the current directory

(4) In the current directory, create a directory test1 with a permission of 741, check whether the creation is successful, and modify the permission of test1 in character mode: set it as the owner of the file, and the same group as the file can write, but other than who cannot write

(5) Create a directory test2/teat3/test4 under the directory test1

(6) Enter test2 and delete the directory test3/test4

(7) Copy the .bashrc in the root user directory to /tmp, and change the name to bashrc

(8) Repeat step 7 to ask whether to overwrite before overwriting

(9) Copy the contents of the directory /etc/ to /tmp

(10) Create a file aaa in the current directory

(11) View the permissions, size and time of the file

(12) Forcibly delete the file

(13) Move bashrc under /tmp to /tmp/test1/test2

(14) Delete the /test1 directory and all the files it contains

(15) Create a fjpsc.txt file, use zip, gzip, and tar tools to compress and decompress, and compare the differences between various tools

Compression: zip -v fjpsc.zip fjpsc.txt

Unzip: unzip fjpsc.zip

Compression: gzip fjpsc.txt

Decompression: gunzip fjpsc.txt.gz

Compression: tar -c fjpsc.txt

Decompression: tar -zxvf fjpsc.zip

(16) Create a directory fjpsc, mount the u disk or image CD to this directory

2. File content review, permissions and file search

(1) Use the cat command to add the line number to display the contents of the file /etc/issue

(2) Display the content in /etc/issue in reverse

(3) Use nl to list the contents of /etc/issue

(4) Use the more command to view the file /etc/manpath.config

more /etc/manpath.config

(5) Use the less command to look back and forth at the contents of the file /etc/manpath.config

less /etc/manpath.config

(6) Use the head command to view the contents of the first 20 lines of the file /etc/manpath.config

head -20 /etc/manpath.config

(7) Use the tail command to view the contents of the last 5 lines of the file /etc/manpath.config

tail -5 /etc/manpath.config

(8) View the content of the last 5 lines in the first 20 lines of the file /etc/manpath.config

cat -n /etc/manpath.config | head -n 20 | tail -n 5

(9) Output the content in /usr/bin/passwd in ASCII mode

from -tc /usr/bin/passwd

(10) Enter the /tmp directory, copy /root/.bashrc into bashrc, copy all attributes, and check its date

cp -a /root/.bashrc bashrc

(11) Modify the time of the file bashrc to the current time

touch ./bashrc

4. Experimental experience

Sneaking in to review the basics of Linux, it can be regarded as having fun in the bitterness of postgraduate entrance examination life.

Guess you like

Origin blog.csdn.net/m0_59302403/article/details/130029929