Java programmers commonly used linux commands

linux common commands:
Linux

  1. File related commands:
    LS displays the file or directory
    -l List file details L (List)
    -a list all files in the current directory and directories, including hidden a (all)
    Create a directory mkdir file name
    -p create directories, if there is no parent directory, create the p-(parent)
    cd directory Change directory path
    echo string for the output string of
    cat file name to view file contents
    gedit file name editing files
    tar compression and decompression
    -c: compression
    -x: unzip
    -t : View archive content
    -r: append files to the archive
    -u: update the original compressed files in the
    top five with only one command. And the following command can be used in conjunction with the other.
    -z: gzip properties have
    -j: There bz2 property
    -Z: There compress attribute
    -v: show all processes
    -O: to unlock the file to standard output
    -f: Use file name, remember, this is the last parameter a parameter, behind only access the file name.
    Example:
    the tar -czf jpg.tar.gz * .jpg // all jpg files in the directory into the packed jpg.tar , and which was gzip compression, to generate a gzip compressed package named jpg.tar.gz
    tar -xzvf file.tar.gz// extract the tar.gz
    general archive tar.gz there are other formats.
    cp [parameters] source destination folder
    -r copy all the subdirectories and files
    -l not to copy, but to create a link file
    -f: overwrite the existing destination file without prompting.
    Recopy the directory, you must use the -r.
    Mv [parameters] source folder / source file destination folder / file name or rename the file to move.
    -i: If the specified file directory already exists, the first asking to overwrite the old file;
    -f: do not give any indication when mv operation to cover an existing object files;

rm [argument] file name / folder delete files
-r recursive delete, delete files and subdirectories
-f forcibly removed.
There are three file permissions: w (write) r (read) x (executable)
for file permissions Detailed:
D-XR rwxr the root. 1-X-Jul-30 09:05 4096 the root / mnt /.
① ② ③ ④ ⑤ ⑧ ⑦ ⑥
① type:
d represents the directory
l represents the symbol file. In fact, points to another file.
- indicates a regular file
② file permissions:
chmod [parameters] [authority parameters] file name

File owner represents the creation of user files.
Owned by group expressed permission of the user's group.
③ directory subdirectory number
④ user
chown to change the owner of the file specified users and groups.
⑤ group
belongs to a group of file chgrp change.
⑥ sub-file or subdirectory size of the metadata (properties)
⑦ last time was changed
⑧ file name
find [path] [parameters] [expression] find files
-name by name
-type by file type
such as:. Find -name "* .c" the current directory and its subdirectories for all file name extension is c file listed.
rmdir to delete empty folders were empty directory.
directory tree directory tree display, it is necessary to install the package tree
pwd Displays the current directory

  1. Advanced commands:
    the ping ip / domain test network connectivity
    netstat displays network status information
    -t: TCP port specified display
      -u: specify display UDP port
      -l: Only listening socket (the so-called socket is to make an application to read write and send and receive communication protocols (protocol) and data programs)
      -p: display the process identifier and program name, and each socket / port belongs to a program.
    -n: Do not perform DNS polling, display IP (speed up operation)
    commonly used: netstat -nlp View all ports
    netstat -nlp | grep port number / name of the program to view a program or a port.
    clear clear screen
    reboot reboot the system
    kill process ID to kill the process
    kill -9 process ID, kill the process
    the shutdown
    -r restart shutdown
    -h shutdown not restart
    now immediately shut
    ps displays the status of the current process
    -A list all processes
    -u user display process user information
    -ef display all commands, joint command line
    generally, we will use with grep to view the information we need.
    lsof lists currently open file system. It requires root method to perform,
    meaning lsof output of each column information is as follows:
    name of the process: the COMMAND
    PID: process identifier
    PPID: parent identifier (-R parameters specify)
    the USER: Process owners
    FD: file descriptor, the application file identified by the file descriptor. As cwd, txt
    common:
    lsof abc.txt display on file abc.txt process.
    lsof -c abc abc display process is now open files.
    lsof -u root display root user opens the file information
    lsof -i: port numbers to view the information on a port.
    useradd username add users.
    -d root user settings (Home) Contents
  2. // username passwd to change the password with root privileges.
  3. Let us switch to add new users, you can use passwd to change the password directly.
    su username switch user
    sudo username execution with another user privilege. EX: sudo root
    groupadd GROUPNAME new working group
    usermod -G groupname username will add a user into workgroup
    userdel username delete users
    in general we deleted by: userdel -rf username so you can completely remove.

Guess you like

Origin blog.csdn.net/qq_41703795/article/details/92432692