免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: pppguest3962
打印 上一主题 下一主题

千辛万苦进了一个很深层的目录,一不小心敲了“cd”后回车.. [复制链接]

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
311 [报告]
发表于 2012-01-03 19:25 |只看该作者
cd -,这样就能快速回到上一次的目录了。

论坛徽章:
19
CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-09-18 15:15:15CU大牛徽章
日期:2013-05-20 10:46:44CU大牛徽章
日期:2013-05-20 10:46:38CU大牛徽章
日期:2013-05-20 10:46:31CU大牛徽章
日期:2013-05-20 10:46:25CU大牛徽章
日期:2013-05-20 10:46:18CU大牛徽章
日期:2013-04-17 11:19:51CU大牛徽章
日期:2013-04-17 11:19:42CU大牛徽章
日期:2013-04-17 11:19:37CU大牛徽章
日期:2013-04-17 11:19:32CU大牛徽章
日期:2013-04-17 11:19:28
312 [报告]
发表于 2012-01-03 20:13 |只看该作者
回复 5# dino81


    您强大了,佩服

论坛徽章:
0
313 [报告]
发表于 2012-01-03 20:20 |只看该作者
好歹您也要把Linux基础看过一遍吧,问的问题这么……{:3_196:}

论坛徽章:
0
314 [报告]
发表于 2012-01-04 09:24 |只看该作者
本帖最后由 hbmhalley 于 2012-01-04 09:38 编辑

cd [-L|-P] [dir]
Change the current directory to dir. The variable HOME is the default dir. The variable CDPATH defines the search path for the directory containing dir. Alternative directory names in CDPATH are separated by a colon ( : ). A null directory name in CDPATH is the same as the current directory, i.e., ''.''. If dir begins with a slash (/), then CDPATH is not used. The -P option says to use the physical directory structure instead of following symbolic links (see also the -P option to the set builtin command); the -L option forces symbolic links to be followed. An argument of - is equivalent to $OLDPWD. If a non-empty directory name from CDPATH is used, or if - is the first argument, and the directory change is successful, the absolute pathname of the new working directory is written to the standard output. The return value is true if the directory was successfully changed; false otherwise.

Tilde Expansion

If a word begins with an unquoted tilde character ('~'), all of the characters preceding the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null string, the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the home directory of the user executing the shell is substituted instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name.
If the tilde-prefix is a '~+', the value of the shell variable PWD replaces the tilde-prefix. If the tilde-prefix is a '~-', the value of the shell variable OLDPWD, if it is set, is substituted. If the characters following the tilde in the tilde-prefix consist of a number N, optionally prefixed by a '+' or a '-', the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the dirs builtin invoked with the tilde-prefix as an argument. If the characters following the tilde in the tilde-prefix consist of a number without a leading '+' or '-', '+' is assumed.

If the login name is invalid, or the tilde expansion fails, the word is unchanged.

Each variable assignment is checked for unquoted tilde-prefixes immediately following a : or the first =. In these cases, tilde expansion is also performed. Consequently, one may use file names with tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell assigns the expanded value.

论坛徽章:
0
315 [报告]
发表于 2012-01-07 00:21 |只看该作者
llzzccc 发表于 2009-02-06 06:41
阿阿阿阿阿阿阿,
cd -, pushd, popd, cttl+z, fd $1,2,3, 这些需要熟练使用,Linux下的编程的好助手。
其 ...

这么多命令都是第一次听说。
现在理解了cd -
其它的一般有什么功能啊?

论坛徽章:
0
316 [报告]
发表于 2012-01-07 00:29 |只看该作者
回复 6# ynchnluiti

太强大了!!
   

论坛徽章:
0
317 [报告]
发表于 2012-01-07 09:21 |只看该作者
5L正解

论坛徽章:
0
318 [报告]
发表于 2012-01-31 16:32 |只看该作者
History 记录使用的历史命令

另外上下方向键 不是可以翻出打过的命令么

论坛徽章:
0
319 [报告]
发表于 2012-02-01 01:25 |只看该作者
cd - ,去试试先

论坛徽章:
0
320 [报告]
发表于 2012-02-01 09:14 |只看该作者
cd - 我也学习了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP