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

What are the entry-level knowledge points of linux

2025-04-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is to share with you what are the basic knowledge points of linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux directory architecture

/ root directory

Directory of the commonly used command binary file in / bin

/ boot stores files that must be read when the system starts, including core (kernel)

/ boot/grub/menu.lst GRUB Settings

/ boot/vmlinuz kernel

/ boot/initrd core RAM Disk required to solve the problem

/ dev system peripherals

/ etc system related settings file

/ etc/DIR_COLORS set color

/ etc/HOSTNAME sets the node name of the user

/ etc/NETWORKING only YES indicates the existence of the network

The / etc/host.conf file explains how the user's system queries node names

/ etc/hosts sets the corresponding table of the user's own IP and name

/ etc/hosts.allow setting allows machines using inetd to use

/ etc/hosts.deny setting does not allow machines using inetd to use

/ etc/hosts.equiv sets the remote machine without password

/ etc/inetd.conf sets the configuration of the system network daemon inetd

/ etc/gateways set up the router

/ etc/protocols sets the protocols supported by the system

/ etc/named.boot sets this machine as the configuration file of the name server

/ etc/sysconfig/network-scripts/ifcfg-eth0 sets IP

/ etc/resolv.conf sets DNS

Profile for / etc/X11 X Window, xorg.conf or XF86Config for these two X Server

/ etc/fstab record the file system to power on the mount

/ etc/inittab sets what kind of runlevel the init process will set the system to when the system starts

/ etc/issue records the information displayed before the user logs in

/ etc/group sets the user's group name and related information

/ etc/passwd account information

/ etc/shadow password information

/ etc/sudoers can sudo the configuration file of the command

/ etc/securetty sets which terminals allow root to log in

/ etc/login.defs default configuration when all users log in

/ etc/exports sets the NFS system to use

/ etc/init.d/ the default startup script for all services is placed here, such as to start or disable

/ etc/xinetd.d/ this is the configuration file directory of the services managed by the super daemon

/ etc/modprobe.conf kernel module extra parameter setting

/ etc/syslog.conf log settings file

/ home user's home directory

The function library that will be used by / lib system

/ related modules of lib/modules kernel

/ var/lib/rpm rpm suite installation

When an error occurs when the / lost+found system is abnormal, some missing fragments will be placed in this directory

/ mount point of mnt peripherals

/ media is similar to / mnt

Additional software installed on / opt host

/ proc virtual directory, which is the mapping of memory

/ proc/version kernel version

/ proc/sys/kernel system kernel function

/ root system administrator's home directory

Instructions that can only be executed by a sbin system administrator

/ srv the data directories that some services need to access after they are started

/ tmp is a general user or a place where files are placed when a program is running

/ usr's largest directory, permitted applications and files

/ usr/X11R6: X-Window directory

/ usr/src: Linux source code

/ usr/include: system header file

/ usr/openwin stores the OpenWin of SUN

/ usr/man online user manual

/ binary file directories that can be run by usr/bin users

/ binary file directories that can be run by usr/local/bin users

The function library that will be used by / usr/lib system

The function library that will be used by / usr/local/lib system

Instructions that can only be executed by a usr/sbin system administrator

Instructions that can only be executed by a usr/local/sbin system administrator

/ var log file

/ var/log/secure records files that log in to system access data, such as pop3, ssh, telnet, ftp, etc., will be recorded in this file.

/ var/log/wtmp record the income data of the registrant, last

/ var/log/messages almost systematic error message

The startup or shutdown message shown when var/log/boot.log logging is started or when some services are started

/ var/log/maillog record user records of message access or past (sendmail and pop3)

/ var/log/cron records the contents of the routine service crontab

/ var/log/httpd, / var/log/news, / var/log/mysqld.log, / var/log/samba, / var/log/procmail.log:

Log files for two different web services

Some common basic commands:

Uname-a check the kernel version

Ls-al displays the properties of all files

Pwd displays the current path

Cd-return to last directory cd ~ return to home directory

Date s set time and date

Cal display Calendar cal 2006

Bc computing apparatus

Man & info help manual

Locale displays the current font locale-an all available fonts / etc/sysconfig/i18n settings file

LANG=en uses English fonts

Sync writes data synchronously to the hard disk

Shutdonw-h now & half & poweroff shutdown

Reboot restart

Startx & init 5 enters the graphics interface

/ work &? work looks up and down for document content

Chgrp changes the file group chgrp testing install.log

Chown changes the person chown root:root install.log

Chmod changes the property chmod 777 install.log read=4 write=2 execute=1

Cp replication cp filename

Rm Delete Files rm-rf filename Force Delete Files

Rmdir delete folder

Mv Mobile mv 123.txt 222.txt rename

Mkdir create folder

Touch create file update current time

Cat displays cat from the first line | more paging

Nl adds a line number to the content

More & less flipped side by side

Head-n filename displays the contents of line N

N lines after tail-n filename display

Od displays impure documents

Df-h displays partition spaces

Du displays the size of a directory or file

Fdisk partition settings fdisk-l / dev/hda displays the partition status of the hard disk

Mkfs builds various file systems mkfs-t ext3 / dev/ram15

Fsck checks and repairs LINUX files

Ln hard link ln-s software link

Whereis lookup command

Locate search

Find looks for find /-name "* *. * *"

Which viewing tool

Whoami displays the current user

Gcc-v View GCC version

Chattr + I filename disable deletion chattr-I filename Unban

Lsattr shows hidden file properties

Updatedb updates the database

Mke2fs format mkfs-t ext3

Dd if=/etc/passwd of=/tmp/passwd.bak backup

Mount lists all the partitions of the system

Mount-t iso9660 / dev/cdrom / mnt/cdrom mount CD

Mount-t vfat / dev/fd0 / mnt/floppy mount floppy disk

Mount-t vfat-o iocharset=utf8,umask=000 / dev/hda2 / mnt/hda2 mount fat32 partition

Mount-t ntfs-o nls=utf8,umask=000 / dev/hda3 / mnt/hda3 mount ntfs partition

Linux-NTFS Project: http://linux-ntfs.sourceforge.net/

Umount / mnt/hda3 load

Ifconfig displays or sets network devices

Service network restart restarts the network card

Ifdown eth0 shuts down the network card

Ifup eth0 opens the network card.

Clear screen cleaning

History History! 55 execute instruction 55

Stty setting terminal stty-a

Fdisk / mbr delete GRUB

At schedules work only once.

Crontab follows the routine command [e] to edit, [l] to display, [r] to delete tasks

& background running program tar-zxvf 123.tar.gz &-> background running

Jobs watches the program jobs-l paused in the background.

Fg adjusts the background program to the foreground fg n-> n is a number, which program can be specified.

Bg makes the work run in the background

Kill termination process kill-9 PID [9] forced termination, [15] normal termination, [l] lists available kill signals

Ps aux View daemon

Top View daemon top-d 2 updates top-d 2-p10604 every two seconds to watch a PID

Top-b-n 2 > / tmp/top.txt-> run the top information twice, and then input the information to / tmp/top.txt

Pstree displays the program [A] in a tree view to connect with ASCII, [u] lists PID, [p] lists account numbers.

Killall wants to delete a service killall-9 httpd

Free display memory status free-m-> display in M

Uptime shows the current system boot time

Netstat displays network status netstat-tulnp- > find out the network connections that are already being monitored on the current system and their PID

Dmesg displays boot information demsg | more

Nice sets priority nice-n-5 vi &-> use root to plant a nice as-5, which is used to perform vi

Priority already exists for renice adjustment

Runlevel displays the current runlevel

Depmod Analysis of the dependence of loadable Modules

Lsmod displays modules loaded into the system

Modinfo displays information about the kernel module

Insmod load module

Modprobe automatic processing loadable module

Rmmod delete module

Chkconfig check, set up various services of the system chkconfig-list-> list the status of each service

Ntsysv sets up various services of the system

Cpio backup file compression command:

Files saved by * .Z compress program

*. Files uploaded by the bz2 bzip2 program

*. Files uploaded by the gz gzip program

*. The data packaged by the tar tar program has not been reviewed

*. Files packaged by tar.gz tar programs, which have been downloaded by gzip

Compress filename compressed file plus [- d] decompress uncompress

Gzip filename compression plus [- d] decompress zcat 123.gz to view the contents of the compressed file

Bzip2-z filename compression plus [- d] decompress bzcat filename.bz2 to view the contents of the compressed file

Tar-cvf / home/123.tar / etc packaged without compression

Tar-xvf 123.tar unpack

Tar-zxvf / home/123.tar.gz decompressed with gzip

Tar-jxvf / home/123.tar.bz2 decompressed with bzip2

Tar-ztvf / tmp/etc.tar.gz View tar content

Cpio-covB > [file | device] share

Cpio-icduv

< [file|device] 还原 vi一般用法 一般模式 编辑模式 指令模式 h 左 a,i,r,o,A,I,R,O :w 保存 j 下 进入编辑模式 :w! 强制保存 k 上 dd 删除光标当前行 :q! 不保存离开 l 右 ndd 删除n行 :wq! 保存后离开 0 移动到行首 yy 复制当前行 :e! 还原原始档 $ 移动到行尾 nyy 复制n行 :w filename 另存为 H 屏幕最上 p,P 粘贴 :set nu 设置行号 M 屏幕中央 u 撤消 :set nonu 取消行号 L 屏幕最下 [Ctrl]+r 重做上一个动作 ZZ 保存离开 G 档案最后一行 [ctrl]+z 暂停退出 :set nohlsearch 永久地关闭高亮显示 /work 向下搜索 :sp 同时打开两个文档 ?work 向上搜索 [Ctrl]+w 两个文档设换 gg 移动到档案第一行 :nohlsearch 暂时关闭高亮显示 认识SHELL alias 显示当前所有的命令别名 alias lm="ls -al" 命令别名 unalias lm 取消命令别名 type 类似which exprot 设置或显示环境变量 exprot PATH="$PATH":/sbin 添加/sbin入PATH路径 echo $PATH 显示PATH路径 bash 进入子程序 name=yang 设定变量 unset name 取消变量 echo $name 显示变量的内容 myname="$name its me" & myname=’$name its me’ 单引号时$name失去变量内容 ciw=/etc/sysconfig/network-scripts/ 设置路径 env 列出所有环境变量 echo $RANDOM 显示随意产生的数 set 设置SHELL PS1=’[\u@\h \w \A #\#]\$ ‘ 提示字元的設定 [root@linux ~]# read [-pt] variable —-读取键盘输入的变量 參數: -p :後面可以接提示字元! -t :後面可以接等待的『秒數!』 declare 声明 shell 变量 ulimit -a 显示所有限制资料 ls /tmp/yang && echo "exist" || echo "not exist" 意思是說,當 ls /tmp/yang 執行後,若正確,就執行echo "exist" ,若有問題,就執行echo "not exist" echo $PATH | cut -d ‘:’ -f 5 以:为分隔符,读取第5段内容 export | cut -c 10-20 读取第10到20个字节的内容 last | grep ‘root’ 搜索有root的一行,加[-v]反向搜索 cat /etc/passwd | sort 排序显示 cat /etc/passwd | wc 显示『行、字数、字节数』 正规表示法 [root@test root]# grep [-acinv] ‘搜尋字串’ filename 參數說明: -a :將 binary 檔案以 text 檔案的方式搜尋資料 -c :計算找到 ‘搜尋字串’ 的次數 -i :忽略大小寫的不同,所以大小寫視為相同 -n :順便輸出行號 -v :反向選擇,亦即顯示出沒有 ‘搜尋字串’ 內容的那一行! grep -n ‘the’ 123.txt 搜索the字符 —-搜尋特定字串 grep -n ‘t[ea]st’ 123.txt 搜索test或taste两个字符—利用 [] 來搜尋集合字元 grep -n ‘[^g]oo’ 123.txt 搜索前面不为g的oo—-向選擇 [^] grep -n ‘[0-9]‘ 123.txt 搜索有0-9的数字 grep -n ‘^the’ 123.txt 搜索以the为行首—-行首搜索^ grep -n ‘^[^a-zA-Z]‘ 123.txt 搜索不以英文字母开头 grep -n ‘[a-z] 123.txt 搜索以a-z结尾的行—- 行尾搜索$ grep -n ‘g..d’ 123.txt 搜索开头g结尾d字符—-任意一個字元 . grep -n ‘ooo*’ 123.txt 搜索至少有两个oo的字符—重複字元 * sed 文本流编辑器 利用脚本命令来处理文本文件 awd 模式扫描和处理语言 nl 123.txt | sed ‘2,5d’ 删除第二到第五行的内容 diff 比较文件的差异 cmp 比较两个文件是否有差异 patch 修补文件 pr 要打印的文件格式化 帐号管理 /etc/passwd 系统帐号信息 /etc/shadow 帐号密码信息 经MD5 32位加密 在密码栏前面加『 * 』『 ! 』禁止使用某帐号 /etc/group 系统群组信息 /etc/gshadow newgrp 改变登陆组 useradd & adduser 建立新用户 —>

Useradd-m test automatically sets up the user's login directory

Useradd-m-g pgroup test-> specify the level to which you belong

/ etc/default/useradd related settings

/ etc/login.defs UID/GID related settings

Passwd change password-- > passwd test

Usermod modifies user account

Userdel deletes the account-- > userdel-r test

The SHELL used by chsh when replacing the login system [- l] shows the available SHELL; [- s] to modify its own SHELL.

Chfn changes the information displayed by the finger instruction

Finger finds and displays user information

Id displays the user's ID-- > id test

Groupadd add Group

Groupmod is similar to usermod

Groupdel delete group

Su test change user su-enter root and use the environment variable of root

Sudo executes instructions in another capacity

Visudo editor / etc/sudoers adds a line of "test ALL= (ALL) ALL"

% wheel ALL = (ALL) sudo is available to users of all wheel groups in the ALL system

% wheel ALL = (ALL) NOPASSWD: all users in the ALL wheel group do not use the password NOPASSWD

User_Alias ADMPW = vbird, dmtsai, vbird1, vbird3 join the ADMPW group

ADMPW ALL = NOPASSWD:! / usr/bin/passwd, / usr/bin/passwd [A-Za-z] *,\

! / usr/bin/passwd root can change the user's password, but not the root password (add before the instruction! Representative is not allowed)

PAM (Pluggable Authentication Modules, embedded module)

Who & w to see who is online

Last's recently logged-in host information

Lastlog recently logged in time read / var/log/lastlog

Talk talks to other users

Write send message write test [ctrl] + d send

Mesg sets the write permission of the terminal mesg n forbids receiving mesg y

Wall sends messages to all users wall this is q test

Mail writes mail

/ etc/default/useradd home directory default settings

Quota shows the space and limits used by the disk quota-guvs-> shows the current root's own quota limit

Quota-vu query

Quotacheck checks disk space and limits quotacheck-avug-> scan all partition with quota support in / etc/mtab

Forced scanning

Quota must be a separate partition with two files, quota.user and quota.group, and add a sentence to / etc/fstab:

/ dev/hda3 / home ext3 defaults,usrquota,grpquota 1 2

Chmod 600quota* setup is complete, restart takes effect

Edquota edit user or group quota [u] user, [g] group, [p] replication, [t] set grace period

Edquota-a yang edquota-p yang-u young-> replication

Quotaon enable disk space limit quotaon-auvg-> start all filesystem with quota

Quotaoff turns off disk space limits quotaoff-a-> closes quota limits

Repquota-av checks the limit status of all filesystem with quota in the system

The main steps from Quota's initial preparation of filesystem support to the end of the entire configuration are probably:

1. Configure the filesystem of partition to support quota parameters:

Since quota must be supported by filesystem on partition, generally speaking, ext2/ext3 has the best degree of support.

I haven't read any other filesystem types! The most simple way to enable filesystem to support quota is to edit / etc/fstab

Enable quota disks to be prepared to support quota disks

2. Create a quota log file:

As previously checked, the file for recording disk limit values for the whole quota is aquota.user/aquota.group.

To create these two files, you must first use quotacheck scanning!

3. Edit quota limit data:

Then use edquota to edit the available space for each user or group.

4. Re-scan and start quota:

After setting up the quota, the suggestion can be quotacheck again, and then start it with quotaon.

Brief introduction of boot proc

1. Enter the hardware information of BIOS and get the code name of the first startup setting.

2. Check the boot information of the boot Loader (that is, lilo, grub, spfdisk, etc.) of the first boot setting of MBR

3. Enter Kernel for system core information, Kernel starts to uninstall, and tries to run all hardware settings.

4. Kernel runs init program and gets run-level information

5. Init executes / etc/rc.d/rc.sysinit files

6. Start the core external module (/ etc/modprobe.conf)

7. Init executes each batch file of run-level (Scripts)

8. Init executes / etc/rc.d/rc.local files

9. Run / bin/login program and wait for the user to log in

10. After login, the host is controlled by Shell.

Within / etc/rc.d/rc3.d, the one that starts with S starts, the one that starts with K turns off, and the number that follows represents the order of execution.

GRUB vga Settin

Color\ Resolution 640 × 480 800 × 600 1024 × 768 1280 × 1024 bit

256 769 771 773 775 8 bit

32768 784 787 790 793 15 bit

65536 785 788 791 794 16 bit

16.8M 786 789 792 795 32 bit

. / configure check system information. / configure-help | more help information

Make clean erases the files left before.

Make compilation

Make install installation

Rpm-Q-> query whether to install rpm-ql-> query all directories of the suite

Rpm-qi-> query package description rpm-qc [d]-> configuration and description files

Rpm-ivh-> install rpm-V-> see if the package has been changed

Rpm-e-> remove rpm-Uvh-> upgrade installation

-nodeps-> forced installation-test-> Test installation

Thank you for reading! This is the end of this article on "what are the basic knowledge points of linux?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Servers

Wechat

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

12
Report