Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[3 hodgepodge] history directory structure ls usage to view file status

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

First, command history:

Command: history history file: .bahs _ history

Description: after the user logs in, the commands are saved in memory. After the user exit logs out, the commands in memory will be saved to .bash _ history.

Common command options:

-c: clear all historical commands in memory

-d: delete the command with the specified number

#: show the most recent # commands

-s: create a command that does not execute to the history list (fake)

-a: read the command history from the history list into the history file (append new commands)

-n: read the commands from the history file into the history list (read only the newly added)

-r: read the commands in the history file to the history list (read all, so there may be duplicates)

-w: read the commands in the list to the history file (read all, so there may be duplicates)

Common variables and options:

HISTSIZE: defines the total number of variables that can be saved in the history list. Default is 1000.

HISTFILESIZE: defines the total number of variables that can be saved in the history file. The default is 1000.

HISTCONTROL:ignoredups ignores duplicate commands (connected to two identical commands), default

Ignorespace ignores commands that start with a space

Ignoreboth includes the above two options

Erasedups ignores duplicate commands

HISTTIMEFORMAT= "% F% T": displays the execution time of the command.

HISTIGNORE: ignore commands to the command history

How to get the above help: man bash-> / HISTCONTROL

Get the history command:

!! : get the previous command

! #: get Article # command

! Char: get the most recent command that starts with char

!? Go: gets the most recent command that contains go characters

Ctrl+r: search history command, matching the most recent

Get the history command parameters:

! ^: get the first parameter of the previous command

! $: gets the last parameter of the previous command

! : #: get the # th parameter in the previous command

! #: *: get all the parameters in the # command

! #: ^: get the first parameter in the # command

! Char: ^: get the first argument of a command that starts with char

! Char:$: gets the last argument of a command that starts with cahr

Note: HIST* parameters take effect temporarily if they are only on the command line, and will expire after restart, or they can be written to the .bash _ profile file (valid for a certain user only). By default, they are written in / etc/profile (globally valid), so you can see that the individual takes precedence over the global one.

II. File system and directory structure

File system names are not case sensitive (except for vfat systems)

Files have two types of data:

Metadata: metadate inode permission, size, ownership, group, time and other information.

Data: contents of date block fil

Identify according to color:

Blue: catalog fil

Green: executable file

Red: compressed fil

Light blue: linked fil

Pink: socket fil

Gray: other files

File system structure:

/ boot: place the bootstrap, kernel file

/ etc: place the profile

/ bin: binary files executed by ordinary users

/ dev: place device files

Block: block device, random execution, with cache

Char: no cache for sequential execution of character devices

/ home: home directory

/ sbin: binary file executed by the administrator

/ local/sbin: software installed by a third party

/ tmp: temporary file

/ usr: generally shared read-only files

/ bin: provides executable binaries to a user

/ share: structured independent data, such as man, doc, etc.

/ var: files that change frequently

Cache: application cache data directory

Lib: application state information data

Log: log fil

Run: running process-related data, commonly used to store process pid files

/ mnt: temporarily mount files

/ media: mount point, which is often used to mount optical discs

/ proc: virtual file system used to output kernel information and process information

/ sys: virtual file system for outputting hardware device phase information of the current system

/ selinux: the location where relevant security policies and other information are stored

Absolute path: start with the root directory and look up the file path sequentially

Relative path: do not start with the root directory, start with the current directory to find the path to the file.

Cd.. Get in the last path.

Cd-returns the previous path

Cd-enter your home directory

Third, the usage of ls:

-A: do not display "." And ".." File

-a: show all files

-d: display the directory itself

-l: long format display, display metadata

-h: display in a way that is easy for humans to understand

-1: display all files on one line

-S: display in order from large to small

-Sr: displayed in order from largest to smallest

-- time=atime: does not display the modification time, but shows the access time

-utl: sort by atime in the order from new to old according to time

-ctl: sort by ctime in the order from new to old according to time

-U: no sorting, displayed in the order in which the files are stored

4. Check the file status

Command: stat file

Atime: access time-> read time

Mtime:: modification time-> content change ll shows the modification time mtime

Ctime: change time-> refers to metadata change (permission name, group master, etc.)

It is not necessary to visit echo xxx > > F1 to modify the content without access.

Lock file time: chattr + A file file time will not change

Cat will not change atime. If atime is more than one day old, it will change. If atime is older than mtime time, it will also change.

Assignment:

Show only hidden files in a directory

Ls-ad. *

Only the list of directories under a directory is displayed

Ll-ad * /

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report