命令行及git命令

几个命令行

  • ls

ls命令是linux下最常用的命令。ls命令就是list的缩写缺省下ls用来打印出当前目录的清单如果ls指定其他目录那么就会显示指定目录里的文件及文件夹清单。 通过ls 命令不仅可以查看linux文件夹包含的文件而且可以查看文件权限(包括目录、文件夹、文件权限)查看目录信息等等。

常用为:

  - List files one per line:
    ls -1

  - List all files, including hidden files:
    ls -a

  - Long format list (permissions, ownership, size and modification date) of all files:
    ls -la

  - Long format list with size displayed using human readable units (KB, MB, GB):
    ls -lh

  - Long format list sorted by size (descending):
    ls -lS

  - Long format list of all files, sorted by modification date (oldest first):
    ls -ltr

  • cat

cat命令的用途是连接文件或标准输入并打印。这个命令常用来显示文件内容,或者将几个文件连接起来显示,或者从标准输入读取内容并显示,它常与重定向符号配合使用。 

常用为:

  - Print the contents of a file to the standard output:
    cat file

  - Concatenate several files into the target file:
    cat file1 file2 > target_file

  - Append several files into the target file:
    cat file1 file2 >> target_file

  - Number all output lines:
    cat -n file
 

  • mv

mv命令是move的缩写,可以用来移动文件或者将文件改名(move (rename) files),是Linux系统下常用的命令,经常用来备份文件或者目录

常用:

  - Move files in arbitrary locations:
    mv source target

  - Do not prompt for confirmation before overwriting existing files:
    mv -f source target

  - Do not prompt for confirmation before overwriting existing files but write to standard error before overriding:
    mv -fi source target

  - Move files in verbose mode, showing files after they are moved:
    mv -v source target

  • touch

touch命令不常用,一般在使用make的时候可能会用到,用来修改文件时间戳,或者新建一个不存在的文件。

常用:
  - Move files in arbitrary locations:
    mv source target

  - Do not prompt for confirmation before overwriting existing files:
    mv -f source target

  - Do not prompt for confirmation before overwriting existing files but write to standard error before overriding:
    mv -fi source target

  - Move files in verbose mode, showing files after they are moved:
    mv -v source target


explainshell.com 的使用方法:

url为:https://explainshell.com

在输入中输入需要查询的命令行,会有相关对应解释。


git的常用命令:

整个流程为 git init->git add->git commit->git pull->git push

  • git init

git-init的時候,會在working directory下建立.git目錄,裡面放的是git repository的檔案,有了這些檔案,你才可以在這個working directory裡做git的操作

  • git add

 暂存区操作使用 git add 命令,git add <filename> 可以添加单个文件至暂存区,我们可在当前空的 learngit 文件夹中加入文件;此时,暂存库(stage)中会存有之前 add 的文件。

  • git commit 

将暂存区的修改提交到分支。

常用为:

  - Commit staged files to the repository with a message:
    git commit -m message

  - Auto stage all modified files and commit with a message:
    git commit -a -m message

  - Replace the last commit with currently staged changes:
    git commit --amend
 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值