您的位置:首页 > 运维架构 > Linux

Linux Quick Reference (1)

2018-01-30 13:35 351 查看
所有下面的指令都是在Linux环境下使用的

mkdir - To organize files and directions. This will make a new directory: 例子:mkdir Programs 这样就可以创立一个名叫Programs的文件夹了

cd - change into another directory:

a. To change into a specific directory: cd CS_Program

b. To change into a directory using a wild card: cd CS*

c. To change back to the directory above: cd ..

d. To change to the root directory (regardless): cd

ls - list directory contents:

a. To list contents of the current directory: ls

b. To list the contents of specific files (e.g., that start with a capital P): ls P*

c. To list the contents of a specific directory: ls CS_Program

d. To list the contents of directories using a wild card: ls CS*

e. Add flags to get more detailed displayed: ls -l/etc

f. Use the wildcard() to list all the .cpp files in the current director: ls .cpp

cat - to display the contents of a file: cat test1.cpp

pwd - to determine your current path and directory name: pwd

cp - copy a file or directory:

a. For example: cp source dest if you want to copy a directory use the -R option for recursive. The forward slash (in front of the path) means that we are working from the root directory: cp -R ./source ./dest

b. The source and destinations may be complete paths or a path from the current directory, the following will copy the entire CS_Program directory and all of its files into the CS_program directory:

mkdir CS_program

cp -R CS_Program CS_program

mv - move a file or directory. You could think of this as a rename but it can also move a file to another directory! Make sure to pay close attention to the order of the arguments. The first argument (source) is the file or directory that you want to copy from and the second arguments (dest) is the file that you want to copy to (e.g., the file to be created). Keep in mind that a move does not leave the original (unlike copy) so use it with great caution !

a. Syntax: mv source dest

b. Move a file: mv program1.cpp new_name.cpp

c. Rename a directory: mv CS_Program new_directory_name
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: