如何在linux中创建和进入目录?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10601167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:20:07  来源:igfitidea点击:

How to create and enter a directory in linux?

linuxsh

提问by Dimitar Slavchev

How to create and enter a directory in GNU/Linux ?

如何在 GNU/Linux 中创建和进入目录?

mkdir Pics | cd Pics

Gives :

给出:

bash: cd: Pics: No such file or directory

采纳答案by Shahbaz

You need to use ;between commands. So

您需要;在命令之间使用。所以

mkdir Pics; cd Pics

What you have written is called a pipe. That means the output of the first program is used as the input to the other, which doesn't make sense because the output of mkdiris nothing or an error and cddoesn't read from input.

你写的东西叫做管道。这意味着第一个程序的输出被用作另一个程序的输入,这是没有意义的,因为 的输出mkdir什么也没有或错误并且cd不从输入中读取。

By the way, ask questions like this in super user

顺便说一下,在超级用户中问这样的问题

回答by Brett Walker

try the following

尝试以下

mkdir Pics; cd Pics

The pipe character is not appropriate.

管道字符不合适。

回答by CoffeeRain

To do multiple commands in one line, you use a semicolon instead of a pipe.

要在一行中执行多个命令,请使用分号而不是管道。

mkdir Pics ; cd Pics

mkdir Pics ; cd Pics

回答by Colin D

The pipe |sends the output of the first to the second command as input.

管道|将第一个命令的输出作为输入发送到第二个命令。

what you need to use is a ;

你需要使用的是 ;

mkdir Pics; cd Pics