Linux Common commands

Source: Internet
Author: User

1. ls command:

Ls-a has file all, including hidden files

Ls-l Detailed list

Read and write execution permissions, number of links, owners, owner, file size, modified time, filename, file type: binary, D directory, l soft link file

Ls-ld View details for a directory

2. mkdir command:

Mkdir-p/tmp/eyv/j101 force recursion to create a directory

Mkdir-p/tmp/eyv/j101/hmp/eyv/j101 multiple directories simultaneously created

3. CD command:

Cd/tmp/eyv/j101

Cd.. /or CD. Return to top level directory

4. PWD command:

Print working directory displays the current directory

5.rmdir: Delete Empty directory, if directory is not empty, delete unsuccessful

RMDIR/TMP/EYV/J101 Delete directory succeeded

RMDIR/TMP/EYV Delete directory failed

6.CP:CP Copy the file or directory,-R for the directory,-p to preserve the file attributes (such as the date the file was created),

Example 1. (Hmp,tmp all say the directly created directory under the system) cp-rp/tmp/hh/hmp/copy the HH directory to the HMP Directory

Example 2.CP source file target directory CP can copy multiple files or directories at the same time

Example 3. CP source files 1 source files 2 destination directory

Example 4. Cp-r/etc/opt/tmp/eyv/j108

Example 5. Cp-r/tmp/eyv/j101/tmp/eyv/j109

If the destination directory does not exist, the destination directory is created (equivalent to replicating the directory, pasting the directory and renaming it to the destination directory), and if present, it is copied to the destination directory.

7. MV Command: Cut files or rename MV

Example: MV Source directory destination Directory

If the destination directory exists, copy the source directory to the target directory,

If it does not exist, the command is equal to the cut source directory, then pasted to the specified location and renamed to the destination directory

8.RM command:

Delete the file rm, the command can also delete the directory to use the option-R if the directory has multiple files and directories forcibly removed with-F,

Example: Rm-rf directory

9.touch command: Create an empty file

Touch/tmp/eyv/j101/students.list

10.cat command: Display file contents,-N Display line number

Cat-n/etc/issue

Cat/etc/services

11.TAC command: Reverse browse, TAC No Line number

Tac/etc/services

12.more Command: Pagination display

Page by space or F

Press ENTER one line down

Q or Q launch

More/etc/services

13.less command:

As with the more command, you can page up.

Press PageUp to page UP, PageDown PAGE Down

Press the up tip, turn up a line, press the down tip, and turn down one line

14.head command: Show first few lines

Example: Head-n 7/etc/services

15.tail command: Displays a few lines at the end

Tail-n 7/etc/services

===== Add user = = =

Useradd Liuneng: Adding a user will have a default password

passwd Liuneng: Change Password

Groupadd Eyvgroup

= = = Change permissions for files and directories = = =

chmod

CHOMD u+x file name

CHOMD g+w,o+r file name

CHOMD g=rwx file name

File permissions:

R:cat,more,head,tail

W:vim

X: Execute

Directory Permissions:

R: List content in a directory

W: can be created in the directory, delete files

X: Access to the Directory

Chown: Change owner, limited to root operation only

Example: Chown Liuneng file name

Example: Create directory/tmp/eyv/j101, permission information for this directory: Drwxr-xr-x.
chmod 777/tmp/eyv/j101
Create Hello.list in j101, the default permission for the file is-rw-r--r--.
Add New User Liuneng
With Liuneng login system, perform delete hello.list operation, can be deleted normally, because j101 have read and write Execute permission
Use Liuneng to enable a single client login to Linux, enter the/tmp/eyv/j101 directory, you can enter the normal
chmod o-x j101 Remove the other user to the folder on the j101 execution rights: again Liuneng login to Linux, into the/tmp/eyv/j101 directory, found unable to enter

CHGRP: Change the group to which the file belongs

CHGRP: User group name, file name

Umask default permissions for displaying and setting files

Umask-s

Umask 023 (Note: 777-023=754)

===vim Command = = =

Vi/tmp/eyv/j101/wulihai.mesg

o Insert Mode

ESC Command mode

: Enter colon into edit mode

: Set number sets line numbers

: Wq exit

A after the cursor is inserted

I insert before cursor

A cursor is inserted at the end of the line

I inserted at the beginning of the cursor

o Insert a new line under the cursor

O insert a new line on the cursor

= = Set static ip===

The 1.VI command goes into the settings configuration file

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

2. Insert Fill IP address, subnet mask, gateway, DNS, etc., save exit

Onboot=yes
Bootproto=static
dns1=192.168.1.1
ipaddr=192.168.1.119
getway=192.168.1.1

3. Restart the Network service. Service Network restart
Service Network restart

4. Test whether you can connect to Linux from Windows through the ping command
If the ping differs, remember that the VM virtual machine is set to bridged. Then, restart the Network Services service network restart, and then ping

FTP Service:
Service VSFTPD Start

Shutting down the firewall
Service Iptables Stop

============ installation jdk=======
Create path:/usr/java
Create FTP directory:/var/ftp
Download JDK
FTP Upload to/var/ftp
installation command: RPM-IVH ' JDK installation package path ' (I is install installation, V is verbose installation details, H is the hash display progress)
After the installation is complete,/usr has one more JDK directory
See if the JDK follows success: Javac or Java-version command
Write a Helloworld.java program to test whether it can execute properly


Uploading Tomcat
Unpacking the GZ package: Gunzip apache-tomcat-6.0.37.tar.gz
Unzip the TAR package: TAR-XVF Apache-tomcat-6.0.37.tar
Go to unpack: Run Tomcat under./startup.sh
Shut down firewall: Service iptables stop
Access tomcat address from Windows: http://192.168.1.119:8080/


3) environment variable configuration

? Configure Java_home

# exportjava_home=<jdk-install-dir>

Here <jdk-install-dir> install path for JDK (drag folder location directly), such as:/usr/java/jdk1.7.0_25

? Configure path

# Export path= $JAVA _home/bin: $PATH 4) Verify that the environment variables have been set for the root user java_home

# sudo env | grep java_home5) Add to File/etc/sudoers

? Open File:

[Email protected] www.linuxidc.com linux]# vim/etc/sudoers

? Enter edit state:

Press the keyboard "I" key

? Add the following line:

Defaults env_keep+=java_home? Exit Edit Status:

Press the keyboard "ESC" key

? save and exit the file

Press the keyboard "Shift" + ":" Key, enter: WQ; or force exit: wq!; Do not save exit file: Q

Linux Common commands

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.