Linux operating system disk partitions, instructions

Keywords: Linux CentOS

1. Linux Disk Partitions

  Total: 20G

Linux Disk Partition
Partition nameCatalogcapacity
Primary partition/>2G
boot partition/boot500M or so
Swap partition/swap500~600M
User Partition/homeRemaining All
  • /boot: Used to store files necessary for Linux startup, that is, the contents of the boot partition we built
  • /home:Home directory for common users of the system
  • /swap: When the physical memory of the system is not enough, a portion of the physical memory needs to be freed up for use by currently running programs. The freed space may come from programs that have not operated on for a long time, and the freed space is temporarily saved in swap space until those programs are running, then the saved data is restored from swap to memory.

2. Instructions

  • System Management Instructions: Restart, Shutdown, View Command Log, View Help, etc.

            Log out, log in, leave: logout, login, exit

            Restart or shutdown:

           init:

            0 means shutdown; 1 means restart to single mode; 2 indicates that it starts in multiplayer mode but has no network; 3 Represents multiple people with network; 4 Keep it for the time being; Indicates that if a graphics module is installed, it starts in a graphics state; 6 indicates normal startup

            View instruction history:

            View help: man or info

            Exit Help:

           1,q

            2. quit+return

            3. exit+return

           4,ctrl^c

           5,ctrl^d

  • File System Management Instructions: New File or Folder, Copy, Move, View, etc. Instructions for Files

Linux File System Instructions
WindowsLinuxFunctional Description
dirlsView the contents of the specified directory
--pwdShow the current full path
cdcdEnter the specified directory
mkdirmkdirNew empty directory
rmdirrmdirremove empty directories
--touchNew empty file
del rmDelete Files
delrm -frDelete non-empty directories
copycpCopy
movemvMove or cut
findfindFile Lookup
notepadviFile Editing
notepadmoreLook up the contents of the file
--lnNew File Link
cp xy position --take xy Copy to specified location

mv xyz xy --take xyz Renamed xy

find / -name file name --Find the file with the specified file name from the root directory

find / -size +500M --Find more than 500 starting from the root directory M Files

ln ab bc --Hard link, ab->File, order bc->file

ln -s bc xy --Soft link, bc->File, order xy->Another Storage bc Absolute path file->bc

Attachment: Linux file types

d -- Catalog Files

b -- Block device files

- - - General Files

l -- Linked Files

c -- Character file

p -- Pipeline File|grep|Pipeline

s -- Socket file

  • Account Management Directive: New Directive to Modify or Delete Accounts

            Create a new account:

  1. Add your account name string to the account profile
  2. Create a new subdirectory under the home directory with the same name as the account name
  3. Add a new mailbox account to the system
useradd Account Name --New user at the same time under the root directory home There is an additional folder in the file house with the same name as your account

cd ~ --This command allows the user to quickly enter the user's corresponding " home"

passwd Account Name --Change Password

userdel Account Name--Delete users, there will be residues home Subdirectories and mailboxes in folders

userdel -r Account Name --Remove completely

alt+f1 --Switch Terminal(user)
or
alt+FN+f2 --Switch Terminal(user)

hostname username --change localhost by username

su Account Name --Switch Users

exit --Back to the last logged on user
  • Rights Management Directives: Directives to configure access rights

useradd -g Account name 1 Account name 2 --Newly build user2 User makes it and user1 Users in a group

groupadd workspace --New Group

useradd -g workspace Account Name --Newly build user User Join workspace In Group

useradd -G Group 1,Group 2,Group 3 Account Name --take user Users joined groups 1, 2, 3

usermod -g worlkspace Account Name --Put Users user1 Join in workspace In Group

groupdel Group name --Delete if there are no users in the group

chmod u+wx,g-r,uo+r file name --Let the owner of this file have write and execute permissions, people in the same group as the owner lose read permissions, and owners and others have read permissions

chmod a+x file name --Execution rights for all roles to add files

chown Account name file name --Change the owner of the file to a specified user

chmod    754    ccc --To grant authorization

   u          g         o

  111      101      100

  rwx       r-x        r--
  • Task Management Instructions: Instructions to view and terminate processes

           

ps --View process

kill --Kill Process

        Interview Question: How can I force an exit without saving the vi editor?

        1. Enter q! Force exit.

        2. Kill vi processes with kill +process number.

  • Disk and memory management

           

df --View disk space
  • Network Management

Networking:

Enter the root directory: cd /

Enter sysconfig/network-scripts:cd under the ET folder   / etc/sysconfig/network-scripts

Modify the ifcfg-ens33 file as follows:

  Save Exit: wq

        Execute in the / etc directory: ls re* Find the file at the beginning of re, find resolv.config to find the configured DNS server

  • Service Management

service network restart --service network restart

service Module name behavior ( start,stop,restart)--Operating on a service module

service iptables stop --Close Firewall
  • Software mounting

mount /dev/cdrom Folder --Mount your disc to the specified file

umount /tmp --Unload Disc
  • Installation Management

rpm -ivh Installation package --install

wget url --Installation Package Download Address 

rpm -e Software Name --uninstall  

rpm -q Software Name--Query Software Name


yum search  Command Name --Find the real name of the installation package

yum install Software Real Name --Download Installation


rpm and yum Difference: rpm A pre-installation package is required. yum Pre-installation packages will be automatically downloaded

Shell

echo "" --single line output

Echo-e "a\nb" --Implementing the function of line breaks

Echo-e "\a" --pc whistle

Echo-e "a\bc" --Print c   '\b'is a fallback

Posted by danelkayam on Fri, 12 Nov 2021 09:43:46 -0800