Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Usage Analysis of cm Command example of Linux

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail the "Linux cm command example usage analysis", with detailed content, clear steps and proper handling of details. I hope that this "Linux cm command example usage analysis" article can help you solve your doubts.

Command name: cd represents: switch directory usage platform: all Linux distributions are executed: command line permissions: access to your own directory or other specified directory level: basic / beginner

Switch from current directory to / usr/local

Avi@tecmint:~$ cd / usr/localavi@tecmint:/usr/local$

Use the absolute path to change from the current directory to / usr/local/lib

Avi@tecmint:/usr/local$ cd / usr/local/libavi@tecmint:/usr/local/lib$

Switch from the current path to / usr/local/lib using a relative path

Avi@tecmint:/usr/local$ cd libavi@tecmint:/usr/local/lib$

* * (a) * * switch the current directory to the previous directory

Avi@tecmint:/usr/local/lib$ cd-/ usr/localavi@tecmint:/usr/local$

* * (b) * * switch the current directory to the parent directory

Avi@tecmint:/usr/local/lib$ cd.. avi@tecmint:/usr/local$

Show the working directory where we left last (using the'- 'option)

Avi@tecmint:/usr/local$ cd-/ home/avi

Return two levels from the current directory to the superior

Avi@tecmint:/usr/local$ cd.. /.. / avi@tecmint:/$

Return from any directory to the user home directory

Avi@tecmint:/usr/local$ cd ~ avi@tecmint:~$

Or

Avi@tecmint:/usr/local$ cdavi@tecmint:~$

Switch the working directory to the current working directory (LCTT: what's the point?! )

Avi@tecmint:~/Downloads$ cd .avi @ tecmint:~/Downloads$

Or

Avi@tecmint:~/Downloads$ cd. / avi@tecmint:~/Downloads$

Your current directory is "/ usr/local/lib/python3.4/dist-packages". Now you need to switch to "/ home/avi/Desktop/", which requires: one line of command, switch up to'/', and then use the absolute path.

Avi@tecmint:/usr/local/lib/python3.4/dist-packages$ cd.. / home/avi/Desktop/avi@tecmint:~/Desktop$

Switch from the current working directory to / var/www/html, which requires: do not type the command completely, use TAB

Avi@tecmint:/var/www$ cd / vUniverse wplash haviduct tecmintVarUnix www Universe html$

Switch from the current directory to / etc/v__ _. Oh, my God, you forget the name of the directory, but you don't want to use TAB.

Avi@tecmint:~$ cd / etc/v*avi@tecmint:/etc/vbox$

* * Please note: * * if only one directory starts with'v', this will move to 'vbox'. If many directories start with'v 'and no more criteria are provided on the command line, this will move to the first directory that starts with' v'(in the order in which their letters exist in the standard dictionary)

You want to change to the user 'av' (not sure whether it is avi or avt) directory instead of TAB.

Avi@tecmint:/etc$ cd / home/av?avi@tecmint:~$

Pushed and poped under Linux

Pushed and poped are Linux bash commands and several other scripts that can save the current working directory location to memory and read the directory from memory as the current directory. These scripts can also change directories.

Avi@tecmint:~$ pushd / var/www/html/var/www/html ~ avi@tecmint:/var/www/html$

The above command saves the current directory to memory, and then changes to the required directory. Once poped is executed, it fetches the saved directory location from memory as the current directory

Avi@tecmint:/var/www/html$ popd~avi@tecmint:~$

Switch to a directory with a space in its name

Avi@tecmint:~$ cd test\ tecmint/avi@tecmint:~/test tecmint$

Or

Avi@tecmint:~$ cd 'test tecmint'avi@tecmint:~/test tecmint$

Or

Avi@tecmint:~$ cd "test tecmint" / avi@tecmint:~/test tecmint$

Change from the current directory to the download directory and list what it contains (use one-line command)

Avi@tecmint:/usr$ cd ~ / Downloads & & ls....service_locator_in.xlssources.listteamviewer_linux_x64.debtor-browser-linux64-3.6.3 copyright US.tar.xz. After reading this, the article "cm Command instance usage Analysis of Linux" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report