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

Big data's Road to becoming a God-the Foundation of Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Linux command

I'm Xiaobai. I've never played Linux before. Please click here:

Https://user-gold-cdn.xitu.io/2019/2/24/1691e1dda7807059

A recommended Git warehouse

I have some basics. I recommend a manual for quick query commands. Please click here:

Https://github.com/jaywcjlove/linux-command

Catalogue of big data's road to becoming a god

Big data develops basic Java Foundation NIO concurrent JVM distributed ZookeeperRPCNettyJava basic NIO concurrent Container JVM distributed zookeeperRPCNetty

The only official account in the network that has helped Java developers to become big data since 0.

Official account big data technology and architecture or search import_bigdata to follow, big data learning route of the latest update, there have been a lot of friends to join ~

Welcome to join us.

Must learn the commands 1.man and page1. Internal commands: echo view internal commands help: help echo or man echo2. External commands: ls view external command help: ls-- help or man ls or info ls3.man document type (1-9) man 7 manman 5 passwd4. Shortcut key: ctrl + c: stop the process ctrl + l: clear screen ctrl + r: search history command ctrl + Q: exit 5. Be good at using tab key 2. Common instructions: when installing linux, create a hadoop user, and then log in to system 1. 1 using the root user. Go to the user root directory cd ~ or cd2. Check the current directory pwd3. Go to the hadoop user root directory cd ~ hadoop4. Return to the original directory cd-5. Return to the previous directory cd.. 6. View all the files ls-la7 under the root directory of the hadoop user. Create a hadoop folder called mkdir / hadoop8. Create src and WebRoot folders under the / hadoop directory: mkdir / hadoop/src mkdir / hadoop/WebRoot simultaneously create: mkdir / hadoop/ {src,WebRoot} into the / hadoop directory Create .classpath and README files in this directory: touch .classpath touch README also create: touch {.classpath, README} View all the files under the / hadoop directory ls-la create a test.txt file under the / hadoop directory At the same time, write the content "this is test" echo "this is test" > test.txt to see the contents of test.txt cat test.txtmore test.txtless test.txt append to the README file "please read me first" echo "please read me first" > > README append the contents of test.txt to the README file cat test.txt > > README copy / hadoop directory to / hadoop-bakcp-r / hadoop / hadoop-bak to the / hadoop-bak directory Move the test.txt to the src directory and change the file name to Student.javamv test.txt src/Student.java create a struts.xml > struts.xml under the src directory to delete all xml type files rm-rf * .xml delete / hadoop-bak directory and all the following files rm-rf / hadoop-bak return to the / hadoop directory to see how many words are in the README file and how many lines wc-w READMEwc-l README returns to the root directory Package the / hadoop directory first, and then use gzip compression to complete it step by step: tar-cvf hadoop.tar hadoop gzip hadoop.tar step by step: tar-zcvf hadoop.tar.gz hadoop decompress it, and then unpack it step by step: gzip-d hadoop.tar.gz or gunzip hadoop.tar.gz step by step: tar-zxvf hadoop.tar.gz packages the / hadoop directory first, while compressing it with bzip2 And save to / tmp directory tar-jcvf / tmp/hadoop.tar.bz2 hadoop extract / tmp/hadoop.tar.bz2 to / usr directory tar-jxvf hadoop.tar.bz2-C / usr/ file command 1. Go to the user root directory cd ~ or cdcd ~ hadoop to return to the original path cd-

two。 View file details

Stat a.txt

3. move

Mv a.txt / ect/

Rename

Mv b.txt a.txt

Move and rename

Mv a.txt.. / b.txt

4 copy and rename

Cp a.txt / etc/b.txt

5.vi undoes the modification

Ctrl + u (undo)

Restore

Ctrl + r (redo)

6. Name password setting alias (invalid after restart)

Alias ll= "ls-l"

cancel

Unalias ll

7. If you want the alias to remain valid after restart, you need to modify it.

Vi / .bashrc

8. Add user

Useradd hadoop

Passwd hadoop

9 create multiple files

Touch a.txt b.txt

Touch / home/ {a.txt,b.txt}

10. Copy the contents of one file to another file in

Cat a.txt > b.txt

Additional content

Cat a.txt > > b.txt

11. A.txt and b.txt can be written by their owners and those who belong to the same group, but not by others:

Chmod ug+w,o-w a.txt b.txt

Chmod a=wx c.txt

twelve。 Make all files and subdirectories in the current directory readable by anyone:

Chmod-R aquir *

13. Set the user owner of a.txt to users and the owner of the group to jessie:

Chown users:jessie a.txt

14. Set the user of all files and subdirectories under the current directory to lamport, and the group owner to users

Chown-R lamport:users *

15. Copy all java programs into the finished subdirectory:

Cp * .java finished

16. List all files with the extension java in the current directory and its subdirectories.

Find-name ".java"

Find files with java extension in the current directory

Find-name. Java

17. Delete files with the extension java in the current directory

Rm-f * .java

3. System command

1. View hostname

Hostname

two。 Modify hostname (invalid after restart)

Hostname hadoop

3. Modify the hostname (take effect permanently after restart)

Vi / ect/sysconfig/network

4. Modify IP (invalid after restart)

Ifconfig eth0 192.168.12.22

5. Modify IP (take effect permanently after restart)

Vi / etc/sysconfig/network-scripts/ifcfg-eth0

6. View system information

Uname-a

Uname-r

7. View the ID command

Id-u

Id-g

8. Date

Date

Date +% Y-%m-%d

Date +% T

Date +% Y-%m-%d ""% T

9. calendar

Cal 2012

10. View file information

File filename

11. Mount the hard disk

Mount

Umount

Load windows Shar

Mount-t cifs / / 192.168.1.100/tools / mnt

twelve。 View file size

Du-h

Du-ah

13. View partition

Df-h

14.ssh

Ssh hadoop@192.168.1.1

15. Shutdown

Shutdown-h now / init 0

Shutdown-r now / reboot

4. Users and groups

Add a tom user, set it to belong to the users group, and add comment information

Step by step: useradd tom

Usermod-g users tom

Usermod-c "hr tom" tom

One step: useradd-g users-c "hr tom" tom

Set the password for the tom user

Passwd tom

Change the login name of the tom user to tomcat

Usermod-l tomcat tom

Add tomcat to the sys and root groups

Usermod-G sys,root tomcat

View group information for tomcat

Groups tomcat

Add a jerry user and set the password

Useradd jerry

Passwd jerry

Add a group that delivers america

Groupadd america

Add jerry to the america group

Usermod-g america jerry

Remove tomcat users from root and sys groups

Gpasswd-d tomcat root

Gpasswd-d tomcat sys

Change the america group name to am

Groupmod-n am america

5. Authority

Create a.txt and b.txt files that are writable by their owner and group, but not by others:

Chmod ug+w,o-w a.txt b.txt

Create a c.txt file that anyone can write and execute

Chmod a=wx c.txt or chmod 666 c.txt

Make all files and subdirectories in the / hadoop directory readable by anyone

Chmod-R aquir / hadoop

Set the owner of all files and subdirectories under the / hadoop directory to root, and the user ownership group to users

Chown-R root:users / hadoop

Set the users of all files and subdirectories under the current directory to hadoop and the group to users

Chown-R hadoop:users *

6. Catalog attribute

1. View folder properties

Ls-ld test

two。 Rwx of the folder

-- x: you can cd in.

Rmurx: you can cd in and ls

-wx: you can cd in and touch,rm your own files, and you can vi other users' files

-wt: you can cd in and touch,rm your own files

Ls-ld / tmp

The permission value of drwxrwxrwt is 1777 (sticky)

7. Software installation

1. Install JDK

Add execution permission

Chmod upright x jdk-6u45-linux-i586.bin

Decompression

. / jdk-6u45-linux-i586.bin

Create a java directory under the / usr directory

Mkdir / usr/java

Cut the extracted jdk1.6.0_45 from the / soft directory to the / usr/java directory

Mv jdk1.6.0_45/ / usr/java/

Add environment variabl

Vim / etc/profile

Add at the end of the / etc/profile file

Export JAVA_HOME=/usr/java/jdk1.6.0_45

Export CLASSPATH=$JAVA_HOME/lib

Export PATH=$PATH:$JAVA_HOME/bin

* Update configuration

Source / etc/profile

two。 Install tomcat

Tar-zxvf / soft/apache-tomcat-7.0.47.tar.gz-C / programs/

Cd / programs/apache-tomcat-7.0.47/bin/

. / startup.sh

3. Install eclipse

8.vim

I

A/A

O/O

R +? Replace

0: the beginning of the current line of the file

$: the end of the current line of the file

G: the beginning of the last line of the file

1 + G to the first line

9 + G to line 9 =: 9

Dd: delete a row

3dd: delete 3 lines

Yy: copy a row

3yy: copying 3 Lin

P: paste

U:undo

Ctrl + r:redo

"a clipboard a

"b clipboard b

"ap pastes the contents of clipboard a

Every time you enter vi, you have a line number.

Vi / .vimrc

Set nu

W a.txt save as

W > > a.txt content is appended to a.txt

: e! Return to the original state

1 the hadoop from the first line to the last line is replaced by root

: 1 hadoop Hadoop hand RootUnip C replace the first line to the next line with root (hint)

9. Find

1. Find executable commands:

Which ls

two。 Find the location of executable commands and help:

Whereis ls

3. Find the file (need to update the library: updatedb)

Locate hadoop.txt

4. Start looking from a folder

Find /-name "hadooop"

Find /-name "hadooop"-ls

5. Find and delete

Find /-name "hadooop"-ok rm {}\

Find /-name "hadooop"-exec rm {}\

6. Find files whose user is hadoop

Find / usr-user hadoop-ls

7. Find files whose user is hadoop and (- a) has group root

Find / usr-user hadoop-a-group root-ls

8. Find files whose user is hadoop or (- o) has a group of root and is a folder type

Find / usr-user hadoop-o-group root-a-type d

9. Find files with permissions of 777

Find /-perm-777-type d-ls

10. Show command history

History

11.grep

Grep hadoop / etc/password

10. Packaging and compression

1.gzip compression

Gzip a.txt

two。 Decompression

Gunzip a.txt.gz

Gzip-d a.txt.gz

3.bzip2 compression

Bzip2 a

4. Decompression

Bunzip2 a.bz2

Bzip2-d a.bz2

5. Package the files in the current directory

Tar-cvf bak.tar.

Append / etc/password file to bak.tar (r)

Tar-rvf bak.tar / etc/password

6. Decompression

Tar-xvf bak.tar

7. Package and compress gzip

Tar-zcvf a.tar.gz

8. Decompress

Tar-zxvf a.tar.gz

Decompress to / usr/

Tar-zxvf a.tar.gz-C / usr

9. View the contents of the package

Tar-ztvf a.tar.gz

Zip/unzip

10. Packaged and compressed into bz2

Tar-jcvf a.tar.bz2

11. Decompress bz2

Tar-jxvf a.tar.bz2

11. Regular pattern

1.cut intercept to: split and retain the seventh segment

Grep hadoop / etc/passwd | cut-d:-f7

two。 Sort

Du | sort-n

3. Query does not contain hadoop

Grep-v hadoop / etc/passwd

4. Regular expression contains hadoop

Grep 'hadoop' / etc/passwd

5. Regular expression (a dot represents any character)

Grep 'h.roomp' / etc/passwd

6. Regular expression begins with hadoop

Grep'^ hadoop' / etc/passwd

7. Regular expression ends with hadoop

Grep 'hadoop$' / etc/passwd

Rules:

. Any character

A: any number of a (zero or more a)

A: zero or one a

A +: one or more a

. Any number of arbitrary characters

. Escape.

A word that begins with h and ends with p

O {2}: O repeat twice

Grep'^ I. {18} nasty'/ usr/share/dict/words

Find lines that do not begin with #

Grep-v'^ # 'a.txt | grep-v' ^ $'

Beginning with h or r

Grep'^ [hr]'/ etc/passwd

It doesn't start with h and r

Grep'^ [^ hr]'/ etc/passwd

It doesn't start with h to r

Grep'^ [^ hmurr]'/ etc/passwd

twelve。 Input and output redirection and piping

1. Create a new file

Touch a.txt

B.txt

two。 Error redirection: 2 >

Find / etc-name zhaoxing.txt 2 > error.txt

3. Enter right or wrong information into log.txt

Find / etc-name passwd > / tmp/log.txt 2 > & 1

Find / etc-name passwd & > / tmp/log.txt

4. Append > >

5. Convert lowercase to uppercase (input redirect)

Tr "Amurz"Amurz"

< /etc/passwd 6.自动创建文件 cat >

Log.txt

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

Internet Technology

Wechat

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

12
Report