linux command quick reference

Upload: nomaddarcy

Post on 31-May-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Linux Command Quick Reference

    1/2

    su switch user

    su - switch to root

    passwd change user's password

    login sign into a new system

    logout log out of a system

    logname retun users login name

    useradd create a new user or update default new user information

    userdel remove a user account

    usermod modify a user account

    groupadd create a new group account

    groupdel enable a super user or root to remove a group

    groupmod enable a super user or root to modify a group

    who display who is on the system

    whois internet user name directory service

    hostid print the numeric identifier for the current hosthostname set or print the name of the currnet host system

    finger list information about the user

    exit exit shell

    reboot reboot the system

    shutdown shutdown the system

    shutdown -r minutes shutdown the system after the specified number of minutes

    poweroff/halt stop the computer

    sleep wait for x seconds to sleep

    date set/display date and time

    settime change file access and modificaiton time

    cal calendar

    time used to time a simple command

    clear clear screen

    echo display message on screen

    printf write formatted output

    df display free disk spaceuname show system information

    whereis locate a binary, source, and manual page files for a command

    env display environment variables

    set set the value of an environment variable

    setenv set the value of an environment variable

    ftp enable ftp access to another terminal

    telnet open a login session on the specified host

    ping send an echo request via TCP/IP to the specified host

    netstat show network status

    mount/umount mount or unmount file systems and remote resources

    jobs list the jobs currently running in the background

    fg continue a stopped job by running it in the foreground

    bg continue a stopped job in the background

  • 8/14/2019 Linux Command Quick Reference

    2/2

    stop cancel a process execution

    ps report the process status

    ps -ef display full information about each of the processes now running

    kill cancel a job, a process

    which locate a command

    . current directory

    .. father directory

    ~ home directory

    $HOME home directory

    pwd print working directory

    ls display directory contents

    ls -l display directory contents in details

    cd/chdir change directorymkdir make directory

    mv change directory or file's name from src to tar or move the src into th

    rmdir remove an existing directory (directory must not be empty)

    rm remove files

    rm -r remove directories (even not be empty)

    rm -rf remove all files and subdirectories (dangerous command)

    cp copy file

    cp -r copy directory

    chmod change the permission of a file

    chown change the owner of a file

    diff display two files and print the lines that are different

    cmp compare two files

    grep search for file(s) with given string, find text within a file

    find . -print | sort print the current directory's structure

    sort sort files

    cat view and/or modify a file

    more display file contents to screen (1 page at a time)

    less opposite of more

    head display the first part of the filetail display the last part of the file

    wc display a count of lines, words, and characters in a file

    tar compress or expand files

    tar -cvvf file.tar myfile.txt

    tar -cvvf home.tar home/

    achieve a tar file

    tar -xvvf myfile.tar

    tar -xvzf myfile.tar.gz -C destdir

    extract the file from a tar file

    gzip/gunzip/gzcat compress or expand files