Linux Quick Reference (1)

所有下面的指令都是在Linux环境下使用的

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

  2. 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

  3. 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

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

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

  6. 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

  7. 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值