This is the 28th day of my participation in the Genwen Challenge

Special directory

  • “.” Represents the directory itself,
  • “..” Represents the parent directory of the directory,
  • For the root directory, “. And “..” All stand for themselves

Hidden files

Anything that starts with. Is a hidden file

Linux File Properties

Linux File types

  • Regular file: [-]

Plain ASCII or binary files

  • Directory: [d]
  • Link file: [l]
  • Device file:

[B];

Character Device file: [c].

  • [P]
  • Socket file: [s]

ls

Ls [-a] [-l] [-i] [-t] [-s][-d][-r]

  • -a all Lists all files, including hidden files
  • -l long Specifies the long format
  • -i inode node
  • -t time sorting
  • – S size order
  • -d directory displays only the directory, not the contents under it
  • -r recursive Displays the contents of the specified directory and subdirectories

chmod

  • Effect: Changes the permission of a specified directory or file.
  • Grammar:Chmod [option] mode File name or directoryIn the syntax of this command, mode represents the permission setting string in the following format:
  1. Character format: [ugoa…] [+-=][rwxX]… ] [,…].
  2. Digital mode: RWX 421 0
  3. [-r] : indicates recursive traversal
chmod a=rwx,u-x,g-wx,o-rwx  test.txt
chmod 640 test.txt
chmod -R 764 DirectoryPath
Copy the code

chown

  • Function: Changes the owning user or owning group of a specified directory or file.
  • Grammar:Chown [option] User name [: group name] File name or directory
  • Root access
  • [-r] : indicates recursive traversal

chgrp

  • Effect: Changes the owning group of a specified directory or file.
  • Grammar:CHGRP [Option] Group name File name or directory
  • [-r] : indicates recursive traversal

cut

  • Function: Filters or extracts specific content from a specified file and displays it on the current screen.
  • Extract columns 1,3, and 5 from /etc/passwd
Cut -d: -f1,3,5 /etc/passwd cut -d: -f 1-5 /etc/passwdCopy the code
  • Extract the contents of the /etc/passwd file from the 2nd to 5th letters
Cut-c2 -5 /etc/passwd cut-c2,5,7 /etc/passwdCopy the code