Linux Operating System Basics

Source: Internet
Author: User

1.Linux Introduction

Linux is a free and open-source operating system with many different versions of Linux, but they all use the Linux kernel. Linux can be installed in a variety of computer hardware devices, such as mobile phones, tablets, routers, desktop computers

2.Linux Introduction

Features of 3.Linux

1. Multi-user, multi-tasking, rich network functions, reliable system security, good portability, standard compatibility, good user interface, excellent speed performance
2. Open source

4.CentOS

1. Mainstream: The current Linux operating system is mainly used in production environments, mainstream enterprise Linux systems are still redhat or CentOS
2. Free: RedHat and CentOS are not very different, based on Red Hat Linux is free to use the source code of the Enterprise CentOS is a level Linux distribution
3. Easy to update: the CentOS exclusive yum command supports online upgrades, updates the system instantly, and does not require money to purchase support services like Redhat!

5.CentOS Mirror

CentOS Website: http://www.centos.org/
CentOS Sohu Image: http://mirrors.sohu.com/centos/
CentOS NetEase Image: http://mirrors.163.com/centos/
CentOS Beijing Polytechnic University Image: http://mirror.bit.edu.cn/centos/

6.Linux directory Structure

7.Linux command

    • First you have to be man.

1. Internal command: Echo
To view internal command help: assist Echo or man Echo

2. External command: LS
View external command help: LS--help or man ls or info ls

Type of 3.man document (1~9)
Man man-pages view the meaning of each type of representation
Man 5 passwd (5 for profile level)


4. Shortcut keys:
CTRL + C: Stop process

CTRL + L: Clear screen

CTRL + R: Search History commands

5. Good at using the TAB key to complete the command

  • used in

    1. Go to the user root directory
    CD ~ or CD

    2. View your current directory
    pwd

    3. Go to the Itcast user root directory
    CD ~itcast

    4. Return to the original directory
    CD-

    5. Go back to the top level directory
    CD..

    6. View all files under the Itcast user's root directory
    Ls-la

    7. Create a Itcast folder in the root directory
    Mkdir/itcast

    8. Create SRC and webroot two folders under the/itcast directory
    created separately: MKDIR/ITCAST/SRC
    Mkdir/itcast/webroot
    create simultaneously: Mkdir/itcast/{src,webroot}

    go to the/itcast directory and create the. Classpath and Readme files in this directory
    create separately: touch. Classpath
    Touch README
    Create simultaneously: Touch {. Classpath,readme}

    View all files under the/itcast directory
    Ls-la

    Create a Test.txt file under the/itcast directory and write the content "This is test"
    echo "This is Test" > Test.txt

    Take a look at the contents of Test.txt
    Cat Test.txt
    More test.txt
    Less test.txt

    Append write to Readme file "Please read Me first"
    echo "Please read Me first" >> README

    Append the contents of the Test.txt to the Readme file
    cat Test.txt >> README

    Copy all files under the/itcast directory to/itcast-bak
    cp-r/itcast/itcast-bak

    go to the/itcast-bak directory, move the test.txt to the SRC directory, and modify the file name to Student.java
    MV Test.txt Src/student.java

    Create a struts.xml in the SRC directory
    > Struts.xml

    Delete all XML types of files
    RM-RF *.xml

    Delete the/itcast-bak directory and all files below
    Rm-rf/itcast-bak

    go back to the/itcast directory to see how many words the Readme file has and how many fewer lines
    wc-w README
    wc-l README

    Go back to the root directory, package the/itcast directory first, and then use gzip to compress
    step through: TAR-CVF Itcast.tar itcast
    gzip Itcast.tar
    One-Step completion: TAR-ZCVF itcast.tar.gz itcast
              
    unzip it, and then cancel the package
    step through: gzip-d itcast.tar.gz or Gunzip itcast.tar.gz
    One-Step completion: TAR-ZXVF itcast.tar.gz

    pack The/itcast directory first, compress it with bzip2, and save it to the/tmp directory
    tar-jcvf/tmp/itcast.tar.bz2 Itcast

    unzip the/tmp/itcast.tar.bz2 to the/usr directory
    TAR-JXVF itcast.tar.bz2-c/usr/
  • Users and Groups

Add a Tom user, set it to belong to the Users group, and add comment information
step through: Useradd Tom
usermod-g users Tom
usermod-c "hr Tom" Tom
One-Step completion: Useradd-g users-c "hr Tom" Tom

set the password for the Tom user
passwd Tom

change Tom User's login name to Tomcat
usermod-l Tomcat Tom

add tomcat to the SYS and root groups
usermod-g sys,root Tomcat

View the group information for Tomcat
groups Tomcat

Add a Jerry user and set a password
Useradd Jerry
passwd Jerry

Add a cross-America group
Groupadd America

add Jerry to the America group
Usermod-g America Jerry

Remove the Tomcat user from the root group and the SYS group
gpasswd-d Tomcat Root
gpasswd-d Tomcat SYS

Modify the America group name to AM
Groupmod-n AM America

    • Permissions

Create A.txt and B.txt files, set them to their owner and group writable, but not others:
chmod ug+w,o-w a.txt B.txt

Create C.txt file Everyone can write and execute
chmod a=wx c.txt or chmod 666 c.txt

Set all files and subdirectories in the/itcast directory to be readable by anyone
Chmod-r A+r/itcast

The owner of all files and subdirectories under the/itcast directory is set to root, and the user has a group of users
Chown-r Root:users/itcast

Sets all files in the current directory and subdirectories to Itcast, set to users
Chown-r Itcast:users *

Use of 8.VIM

Here do not write, there are a lot of information on the Internet, it is recommended to remember the use of commands, to the level of memory,

Linux operating System Fundamentals

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.