Linux常用命令--List of commands(附目录切换命令)

pwd       print working directory

hostname  my computer’s network name

mkdir     make directory

cd        change directory

ls        list directory

rmdir     remove directory

pushd     push directory

popd      pop directory

cp        copy a file or directory

mv        move a file or directory

less      page through a file

cat       print the whole file

xargs     execute arguments

find      find files

grep      find things inside files

man       read a manual page

apropos   find what man page is appropriate

env       look at your environment

echo      print some arguments

export    export/set a new environment variable

exit      exit the shell

sudo      DANGER! become super user root DANGER!

use the .. to move “up” in the tree and path

“Folder“ and “directory“ mean the same thing

command line interface (CLI)

graphical user interface (GUI)

Use the cp - r command to copy more directories with fi les in them

Notice how sometimes I put a / (slash) at the end of a directory? That makes sure the fi le

is really a directory, so if the directory doesn’t exist, I’ll get an error.

附:目录切换及目录堆栈

       跳到自己的 home directory :
   cd ~
  
  跳到目前目录的上上两层 :
   cd ../..
  
   cd - 返回进入当前目录前所在目录

       pushd与popd函数的使用:

      在命令行模式下,当你工作在不同目录中,你将发现你有很多时间都浪费在重复输入上。如果这些目录不在同一个根目录中,你不得不在转换时输入完整的路径名,这难免让人有些难以忍受。但你可以用以下的一个或两个步骤来避免所有多余的输入:用命令行解释器中的历史记录,或者用命令行函数pushd。

       当你键入pushd和一个路径名时,将自动产生一个堆栈,内容是你键入的目录名和你当前工作的目录名。假设你现在工作在 /a 目录下,你键入pushd /b,然后按回车键。此时你会进入到目录 /b 下,同时你将在下一个命令行中看到堆栈中的内容:/b   /a,当你输入pushd后,你会进入/a下。这样两个路径下的切换方式就只需输入pushd即可。如果你需要从堆栈中删除一个目录,键入popd,然后是目录名称,再按回车键。想查看堆栈中目录列表,键入dirs,然后按回车键。

1
2
3
4
5
6
7
[lin@localhost tmp]$ mkdir a
[lin@localhost tmp]$ mkdir b
[lin@localhost tmp]$ cd a
[lin@localhost a]$ pushd b
~/tmp/b ~/tmp/a
[lin@localhost b]$ pushd
~/tmp/a ~/tmp/b
原文地址:https://www.cnblogs.com/linzh104/p/4058641.html