Linux学习笔记
本文主要记录一些学习过程中的Linux命令和对于Linux的想法。
命令
删除文件命令
$ rm
创建文件命令
$ touch
移动文件命令
$ mv [filename] [path]
第一个参数为被移动的文件名
第二个参数为要移动到的路径
创建文件夹命令
$ mkdir
编辑文件命令
$ gedit [filename]
可以对后面的文件进行修改
如果没有入口参数则会直接打开编辑器,编辑后选择保存的位置。
输出重定向
符号>
具有重定向的作用
$ ls >a.txt
上述命令将会把输出保存到当前目录下的 a.txt文件中。
更改输出 命令tee
$ tee
只输出到标准输出,因为没有指定文件嘛。
$ tee [file]
输出到标准输出的同时,保存到文件file中。如果文件不存在,则创建;如果已经存在,则覆盖之。(If a file being written to does not already exist, it is created. If a file being written to already exists, the data it previously
contained is overwritten unless the `-a’ option is used.)
$ tee -a [file]
输出到标准输出的同时,追加到文件file中。如果文件不存在,则创建;如果已经存在,就在末尾追加内容,而不是覆盖。
$ tee -
输出到标准输出两次。(A FILE of -' causes
tee’ to send another copy of input to standard output, but this is typically not that useful as the copies are interleaved.)
$ tee [file1] [file2] -
输出到标准输出两次,同时保存到file1和file2中。
cd命令
$ cd
直接返回到根目录
$ cd [dirname]
进入指定的文件夹
$ cd -
返回到上一次cd
命令时的位置,类似文件管理器中的后退操作。
$ cd ..
向上一个文件夹
$ cd ../..
连续向上俩那个歌文件夹
授权命令chmod
$ chmod 777 [filename]
该命令表示对后面的文件夹授予最高权限
+x
可执行
+w
可写
+r
可读
time命令
放在命令最前面
$ time [othercommand]
可以显示当前命令运行所花费的时间
从网页下载命令
wget [URL]
可以从后面的网页下载文件。