Linux file management command example analysis [display, view, statistics, etc.]

Linux file management command example analysis [display, view, statistics, etc.]

This article describes the Linux file management commands with examples. Share with you for your reference, the details are as follows:

1. Display file contents

cat : Display the contents of a file
tac : Display contents in reverse order

2. Change file permissions

chmod : Change file permissions
-R recursive changes
chown: Change the file owner
-R recursive changes
chgrp: Change the group to which a file belongs
-R recursive changes

>chmod 666 1.txt
 
> chown user1 1.txt
 
>chgrp user1 1.txt


3. Link files

1) Protect the source program

2) Easy access

ln [options] source file or directory target file or directory
-s soft link
Changing one file will affect another file. Deleting the source file will affect the use of the linked file.

-d hard link

Hard-linked files look the same as normal files. Changing one file will affect the other file. When the source file is deleted, the hard-linked file will not be affected.

4. Find files

find [directory list] [matching parameters] [matching criteria]
-name Search by file name
-group Query by the group to which the file belongs
-user query by user name

> find /home/user1 -name 1.txt


5. Other related commands

df View hard disk space
-l View local hard disk
-h Display in 1024-bit
-H Display in base 1000
-T Display partition type
-t Display the specified partition type
-x does not display the specified partition type

> df -lh
 
> df -lH


du View file size
-b In bytes
-k in kilobytes
-m is in megabytes
-h Display in 1024-bit
-H Display in base 1000
-s show statistics

du -s 123 Statistics folder size

mount command

mount /dev/cdrom /mnt/cdrom


umount uninstall command

umount /mnt/cdrom


eject Eject the CD-ROM drive

I hope this article will be helpful for everyone's Linux system maintenance.

You may also be interested in:
  • Use of Linux passwd command
  • Detailed explanation of the use of Linux time command
  • Use of Linux ln command
  • Detailed explanation of commands to read and write remote files using Vim in Linux system
  • Detailed explanation of the usage of grep command in Linux
  • A complete list of commonly used Linux commands (recommended collection)
  • Solve the problem that the commonly used Linux command "ll" is invalid or the command is not found
  • Baota Linux panel command list
  • Extract specific file paths in folders based on Linux commands
  • Linux nohup command principle and example analysis
  • Use of Linux usermod command

<<:  MySQL scheduled task implementation and usage examples

>>:  JavaScript to implement the function of changing avatar

Recommend

Summary of Common Commands for Getting Started with MySQL Database Basics

This article uses examples to describe the common...

XHTML Getting Started Tutorial: XHTML Web Page Image Application

<br />Adding pictures reasonably can make a ...

Detailed explanation of sshd service and service management commands under Linux

sshd SSH is the abbreviation of Secure Shell, whi...

Introduction and analysis of three Binlog formats in MySQL

one. Mysql Binlog format introduction Mysql binlo...

Detailed explanation of jQuery's copy object

<!DOCTYPE html> <html lang="en"...

Windows 10 is too difficult to use. How to customize your Ubuntu?

Author | Editor Awen | Produced by Tu Min | CSDN ...

Canvas draws scratch card effect

This article shares the specific code for drawing...

How to use the Linux more command in Linux common commands

more is one of our most commonly used tools. The ...

Summary of the use of vue Watch and Computed

Table of contents 01. Listener watch (1) Function...

Brief analysis of the MySQL character set causing database recovery errors

Importing data with incorrect MySQL character set...

Linux CentOS6.9 installation graphic tutorial under VMware

As a technical novice, I am recording the process...

Detailed tutorial on running multiple Springboot with Docker

Docker runs multiple Springboot First: Port mappi...