查看目录
ls -al 产看所有目录结构
rm 删除文件
pwd 查看当前目录
Linux 创建文件,并进行输入,修改,移动文件操作
创建hello.txt
touch hello.txt
打开hello.txt
vi hello.txt
i 修改hello.txt文件内容
esc :wq保存并退出文件
cat hello.txt 查看文件
cp hello.txt hello2.txt 复制文件
mv hello2.txt hello3.txt 移动或者重命名文件
rm hello2.txt 删除文件
man rm 查看命令使用方式
echo 'hello' > test.txt 把hello内容覆盖之前的内容
> 表示重定向,如果文件不存在,则创建。
>> 表示重定向,如果文件不存在,则创建。
new: Creates a new session.
open: Opens a session or the session dialog box.
edit: Opens the Session Property dialog box for a session.
list: Lists information of all available sessions.
cd: Changes the current working directory.
pwd: Shows the current working directory.
set: Sets options.
clear: Clears the screen/address/command history.
help: Displays this help. '?' does the same.
quit: Quits Local Shell. 'exit' does the same.
ssh: Connects to a host using the SSH protocol.
telnet: Connects to a host using the TELNET protocol.
rlogin: Connects to a host using the RLOGIN protocol.
sftp: Connects to a host to transfer files securely.
ftp: Connects to a host to transfer files.
disconnect: Closes connection of this session.
reconnect: Reconnects this session.
Linux 快捷键
ctrl + L 清除文本
ctrl + C 跳过正在输入的命令行,直接进入下一行代码,而不执行未输入完成的代码
vi 进入文本编辑后 i进入可编辑状态 ESC :wq 保存并退出 w表示保存,q表示退出
shift + a 进入编辑模式,且进入行尾
ctrl + A 跳到命令行最前面
ctrl + E 调到命令行结尾
mkdir mydir && cd mydir
echo ‘wwwww’ >/>> a.txt 一个>替换原文件,两个追加原文件或者创文件
vi hello.txt
dd删除某一行数据
:set number
:1,5d删除一到五行的数据
Linux 命令之删除命令
在Linux下删除文件用rm命令,具体用法如下:
rm [选项] 文件
选项说明:
-f -force 忽略不存在的文件,强制删除,无任何提示
-i --interactive 进行交互式地删除
-r | -R --recursive 递归式地删除列出的目录下的所有目录和文件
-v --verbose 详细显示进行的步骤
命令实例:
1、常规删除a.txt文件
[root]# rm a.txt
2、强行删除file.log文件
[root]# rm -f file.log
3、删除dirname目录下的所有东西
[root]# rm -R dir dirname
rm -rf dir dirname
4、删除以 -f 开头的文件
[root]# touch ./-f
[root]# ls ./-f
./-f
[root]# rm ./-f
或者使用
[root]# touch -- -f
[root]# ls -- -f
-f
[root]# rm -- -f
:wq 保存文件
文件中 dd删除一行
4.Which 命令
查看客户端安装位置
which git or which docker