Basic Linux Operations

Source: Internet
Author: User
Tags delete key inotify yum repolist

? The numerical of permissions
– Basic permissions: r = 4,w = 2,x = 1

? Set permissions in numeric form
–chmod [-r] NNN documentation ...
–chmod [-r] xnnn documentation ...

[Email protected] ~]# MKDIR/NSD01
[Email protected] ~]# LS-LD/NSD01

[Email protected] ~]# chmod u=r/nsd01
[Email protected] ~]# LS-LD/NSD01

[Email protected] ~]# chmod 755/nsd01/
[Email protected] ~]# LS-LD/NSD01

[Email protected] ~]# chmod 007/nsd01
[Email protected] ~]# LS-LD/NSD01

[Email protected] ~]# chmod 700/nsd01
[Email protected] ~]# LS-LD/NSD01

###################################################
Historical command
? Manage/Invoke commands that have been executed
–histroy: View a list of history commands
–history-c: Empty History command
–!n: Executes the nth command in the command history
–!STR: Performs the most recent history command beginning with Str

? Adjust the number of history commands
[Email protected] ~]# Vim/etc/profile
histsize=1000

####################################################

? Du, the space occupied by the statistics file
–du [Options] ... [directory or file] ...

–-s: Only the total amount of space occupied by each parameter is counted
–-h: Provides readable capacity units (K, M, etc.)

[Email protected] ~]# du-sh/boot//etc/pki/
130m/boot/
1.5m/etc/pki/

################################################
? Date, view/adjust system date Time
–date +%f

–date + "%y-%m-%d%h:%m:%s"

–date-s "Yyyy-mm-dd HH:MM:SS"

################################################
Prepare the Yum source

Customizing the Yum Repository

1. Build the RPM package you downloaded from the network as the source of the Yum repository
2. Pass the tools directory on the real machine to virtual machine a 192.168.4.7

Scp-r/local Path/directory user name @ip address:/destination Path/

Scp-r/root/Desktop/tools/[email protected]:/

[email protected] ' s password:

    1. Generate Warehouse Data files
      [Email protected] ~]# createrepo/tools/other/
      [Email protected] ~]# ls/tools/other/

4. Writing Client Files
[Email protected] ~]# Vim/etc/yum.repos.d/rhel7.repo
[RHEL7]
Name=rhel7
Baseurl=http://192.168.4.254/rhel7
Enabled=1
Gpgpcheck=0
[Other]
Name=other
Baseurl=file:///tools/other
Enabled=1
Gpgpcheck=0
[email protected] ~]# Yum repolist

To view the installation order for RPM packages:
[Email protected] ~]# RPM-QL SL

[Email protected] ~]# yum-y install Oneko
[Email protected] ~]# Oneko & #放入后台运行
[Email protected] ~]# Oneko &
[Email protected] ~]# killall Oneko #杀死所有oneko程序

[Email protected] ~]# yum-y install Cmatrix
[Email protected] ~]# Cmatrix

##########################################################
I node: stored in partition table, function unique identification file number

ln, creating a soft Connect symbol connection (shortcut)
– Soft Connect--the original document--I-node--document data
–ln-s original file or directory soft connection file
If the original file or directory is deleted, the connection file will be invalidated
Soft connections can be stored in different partitions/file systems

? LN, creating a hard connection (shortcut)
– Hard Connect-I-node-to-document data
–ln RAW file Hard connection file
If the original file is deleted, the connection file is still available
Hard connections with original files must be in the same partition/file system

[Email protected] ~]# rm-rf/opt/*
[Email protected] ~]# echo 123 >/opt/a.txt
[Email protected] ~]# cd/opt/
[[email protected] opt]# ls
[Email protected] opt]# ln-s/opt/a.txt/opt/b.txt #软连接
[[email protected] opt]# ls
A.txt B.txt
[Email protected] opt]# Ln/opt/a.txt/opt/c.txt #硬连接
[[email protected] opt]# ls
A.txt B.txt C.txt
[Email protected] opt]# Cp/opt/a.txt/opt/d.txt #复制
[Email protected] opt]# ls-i #查看i节点

[Email protected] opt]# RM-RF A.txt
[[email protected] opt]# ls

####################################################
Zip archive tool, cross-platform

? Archive + Compress operations
–zip [-r] backup file. zip Archive Document ...

? Release Archive + unzip operation
–unzip backup files. zip [-D destination Folder]

Zip-r/opt/test.zip/etc/passwd/boot//home/ls/optunzip/opt/test.zip-d/mnt

######################################################
The "--help" help option is typically provided

? Man, format manual reading tool
– Press the UP, down, PgUp, PgDn keys to scroll and page through
– Press the Q key to exit
– Press the/key backward to find keywords (n, n Toggle)
– Press G to the end of the full text

5: Representative configuration file Help information

[[email protected] ~]# man 5 passwd

#####################################################

Vim Editing Tips

Command mode operation

[Email protected] opt]# CP/ETC/PASSWD/OPT/ABC
[Email protected] opt]# VIM/OPT/ABC

Home key or ^, number 0 jump to beginning of line
End key or "$" key to jump to end of line
GG jumps to the first line of the file
G jump to the end of the file line

Copy/paste/delete
yy, 8yy copy one line at the cursor, 8 lines
Paste p after pasting at the cursor
X or delete key to delete a single character at the cursor
DD, 3dd Delete one line at the cursor, 3 rows
d^ removed from the cursor to the beginning of the line
d$ Delete from cursor to end of line
C (uppercase) is removed from the cursor to the end of the line and enters insert mode

/root backwards to find the string "root"
N, n jumps to the back/previous result
U undo the most recent operation
Ctrl + R cancels the previous undo operation
ZZ Save changes and exit

##################################################
Last-row mode operation

: q! Force quit after you discard an existing change
: Wq or: x Save existing changes and exit
: R/etc/filesystems read into other file contents

[Email protected] opt]# echo 123 >/opt/1.txt
[[email protected] opt]# echo ABC >/opt/2.txt
[Email protected] opt]# Cat/opt/2.txt
Abc
[Email protected] opt]# Vim/opt/2.txt

        :r  /opt/1.txt     #读入其他文本文件内容          :r  

: S/root/admin replaces the line where the cursor is first "root"
: S/root/admin/g replaces all "root" on the line where the cursor is located
: 1,9 s/root/admin/g replaces all "root" of 第1-9 line
:% s/root/admin/g Replace full-text all "root"

: Set NU|NONU display/Do not display line numbers
: Set AI|NOAI Enable/disable auto indent

###################################################

Source Code Compilation Installation

? Key Benefits
– Get the latest version of the software to fix bugs in a timely manner
– Software features can be selected/customized on demand, with more software to choose from
– Source package for various platforms

RPM Package Yum Rpm-ivh

    gcc和make

SOURCE Package------------------> can execute file---------> Run Installation

Step 1: Install the GCC and make development tools
[[email protected]/]# yum-y install gcc make
[Email protected]/]# rpm-q gcc
Gcc-4.8.5-4.el7.x86_64
[[email protected]/]# rpm-q make
Make-3.82-21.el7.x86_64

Step 2:tar Unpacking, releasing the source code to the specified directory

Rm-rf/opt/*tar-xf/tools/inotify-tools-3.13.tar.gz-c (uppercase)/opt/ls/opt/

Step 3:./configure configuration, specify options such as installation directory/function module
Role 1: Detect if GCC is installed on the system
Role 2: Specify options such as installation directory/function module

cd/opt/inotify-tools-3.13/
   # ./configure   --prefix=/mnt/myrpm    #指定安装位置

Common hints: GCC is not installed
Checking for gcc ... no
Checking for cc ... No
Checking for cl.exe ... no

Step 4:make Compile, build the executable binary program file

cd/opt/inotify-tools-3.13/
   # make

Step 5:make Install, copy the compiled files to the installation directory

cd/opt/inotify-tools-3.13/
   # make install# ls /mnt/# ls /mnt/myrpm/# ls /mnt/myrpm/bin/

#######################################################

Basic Linux Operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.