Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux Command Study Notes     - Linux NFS FTP use (Server)

- The script Linux command (Linux)

- Use Ganglia to monitor your cluster (Server)

- GNU / Linux system, how to clean up memory space (Linux)

- Java Concurrency -volatile keywords (Programming)

- C ++ type conversion and RTTI (Programming)

- Linux non-root user uses less than 1024 ports (Linux)

- Use HttpClient remote interface testing (Programming)

- Ubuntu install ruby (Linux)

- Linux Security and Optimization (Linux)

- Linux environment variables inside (Linux)

- How to install the Ruby runtime environment on Mac OS X (Linux)

- How Glances monitoring system on Ubuntu (Linux)

- User rights management system under Linux (Linux)

- MySQL query plan key_len know all (Database)

- Android custom ViewPager create kaleidoscopic image transition effects (Programming)

- How to identify memory leaks in Java (Programming)

- RHEL5.8 physical opportunities to Read-only file system (Linux)

- Ubuntu 10.04 to Ubuntu 10.10 Upgrade (Linux)

- Fundamentals of the Java virtual machine memory management principles (Programming)

  Linux Command Study Notes
  Add Date : 2018-11-21      
  Basic File Operations

ls, rm, mv, ln


 ls [option] [files]

With no parameters, lists the contents of the current working directory

$ Ls

Lists the contents of the specified directory

ls dir1

Or individual files

ls file1


-a lists all files, including hidden files and directories (beginning.)

-l displays the file name properties and detail in long format

-h to k, m, etc. units substituted for users to read bytes

-F Type of drum to symbolize the number to modify a specific file name

/ table of Contents

* executable file

@ Symbol files (symbolic links)

l command pipeline (named pipes)

= Communication channels (sockets)

 Symbol appended to the file name, you can help us to see at a glance their type, these symbols are not a file name

Part, but ls displayed when added to their own.

-i ask price before filling the file name inode number

-s before the filename raise the number of blocks occupied by the file (1 block typically 1024 bytes)

-R Recursively lists the contents of a directory

-d Lists directory itself, not its contents



cp [option] files (file | dir)

Do not add parameter indicates copy a file

$ Cp srcfile destfile

Copy multiple files to a directory

$ Cp file1 fle2 file3 dir

-a or -R option, you can copy the entire subdirectories recursively

-p together with the access mode of the source file, the time stamp also be copied to the new file, if your permissions allow, owner of the new file, and also belongs to the group and the old files. If you can not specify the owner of the item, the new file is your knee is the current time, and the access mode is the access mode of the source file with your umask intersection.

-a copy the entire directory tree, and retention relationship special file access mode, symbolic links and hard links.

This option is equivalent to specifying -R (contains special files, including the recursive copy), -p (access mode)

-d (link)

-i interactive mode, before overwriting the destination file, first seek the views of users

-f force replication, timely target file already exists, it will be unconditionally overwritten.


mv [option] sources target

Moving and renaming is one thing, move command can also change the file name.


mv file1 file2

The file or directory to another directory

mv file1 file2 dir3 dir4 dest_dir

-i interactive mode

-f Force Mobile


rm [options] files | dirs

rm (remove) command to delete a file

rm file1 file2 file3

You can also delete the entire directory

rm -r dir1 dir3


-i interactive mode

-f Force delete, ignore any error or warning HE

-r recursive call for directory and its content,


ln [options] source target

Link link is a reference to another file reference, there ln command established. Divided into two links, break

No connection (symbolic link) to the "path" to indicate another file, wanted the windows shortcuts

Formula (shorcut) or macintosh alias alias

$ Ln -s myfile softlink

If you delete the source file, the symbolic link file does not exist just because the two paths become invalid. On the other hand, hard links (hard link) is the name of a second physical disk file (with terms, hard links point to the same inode). Delete source files and link failure does not cause that you can still access the contents of the source file with hard links.

$ Ln myfile softlink

Symbolic links can span disk partition, because they are only references to the source file path only. But hard links can not, because inode a partition to another partition does not make sense. Objects can make a symbolic link directory, but not hard links, unless you are superuser and using the -d option.

Common options

-s make a symbolic link (the default behavior is to produce a hard link)

-i interactive mode

-f Force mode, unconditionally be covered

-d allow superuser production directory hard links

Object using one of these commands, you can easily find out why a symbolic link

$ Readlink linkname

$ Ls -l linkname

Directory Operations

cd Change the current working directory

pwd Displays the name of the current working directory

basename display the file path in the end portion

Part dirname like the end of the file path outside

mkdir Create a directory

rmdir to delete empty directories

rm -r remove non-empty directory and its contents


cd [directory] bash

shell built-in commands
- Analysis RabbitMQ cluster (Server)
- Depth understanding of JavaScript new mechanism (Programming)
- Web database security tips (Linux)
- Ten best plug surge Emacs Productivity (Linux)
- QEMU code analysis: BIOS loading process (Linux)
- Installation JDK 1.8 under CentOS7 (Linux)
- Linux Basics Tutorial: Combining awk delete data before the specified date hdfs (Linux)
- MySQL EXPLAIN SQL output description (Database)
- 64 Ubuntu 15.04 Linux kernel upgrade to Linux 4.1.0 (Linux)
- ARM constant expression (Programming)
- Linux under DB2SQL1024N A database connection does not exist. SQLS (Database)
- C ++ stderr / stdout redirected to a file (Programming)
- Linux SSH commands (Linux)
- Linux operating process information (Linux)
- Eclipse, Tomcat configuration JNDI connection Oracle data source example (Server)
- Linux user opens a number of adjustment processes (Linux)
- Setting the RedHat9 Intrusion Detection System (Linux)
- Forgot Linux root password (Linux)
- Install Krita 2.8 on Ubuntu 13.10 / 12.04 / 12.10 (Linux)
- Ubuntu 12.04 install RTL8723BE wireless network card driver (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.