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

How to use cd command in linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use the cd command in the linux system, the article is very detailed, has a certain reference value, interested friends must read it!

Linux cd command can be said to be the most basic command statement in Linux. Other command statements to operate are based on the use of cd command.

Course content

Command name: cd

Representative: switch directories

Use platform: all Linux distributions

Execution method: command line

Permissions: access your own directory or other specified directories

Level: basic / beginner

1. Change from the current directory to / usr/localavi@tecmint:~$ cd / usr/localavi@tecmint:/usr/local$2. Using the absolute path, change from the current directory to / usr/local/libavi@tecmint:/usr/local$ cd / usr/local/libavi@tecmint:/usr/local/lib$3. Using the relative path, switch from the current path to / usr/local/libavi@tecmint:/usr/local$ cd libavi@tecmint:/usr/local/lib$4. (a) switch the current directory to the previous directory avi@tecmint:/usr/local/lib$ cd-/ usr/localavi@tecmint:/usr/local$4. (B) switch the current directory to the parent directory avi@tecmint:/usr/local/lib$ cd.. avi@tecmint:/usr/local$5. Show the last working directory we left, avi@tecmint:/usr/local$ cd-/ home/avi6. Return two layers of avi@tecmint:/usr/local$ cd from the current directory to the superior. /.. / avi@tecmint:/$7. Return from any directory to the user home directory avi@tecmint:/usr/local$ cd ~ avi@tecmint:~$

Or

Avi@tecmint:/usr/local$ cdavi@tecmint:~$8. Switch the working directory to the current working directory avi@tecmint:~/Downloads$ cd .avi @ tecmint:~/Downloads$

Or

Avi@tecmint:~/Downloads$ cd. / avi@tecmint:~/Downloads$9. Require one line of command to switch

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$10. TAB is required

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 / v/w/havi@tecmint:/var/www/html$11. Forget the directory name

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)

twelve。 Switch the users you want

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

Pushed and poped under avi@tecmint:/etc$ cd / home/av?avi@tecmint:~$13.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:~$14. Change to the directory avi@tecmint:~$ cd test/ tecmint/avi@tecmint:~/test tecmint$ with a space in its name

Or

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

Or

Avi@tecmint:~$ cd "test tecmint" / avi@tecmint:~/test tecmint$15. Toggle and display

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. The above is all the contents of the article "how to use cd commands in linux system". Thank you for reading! Hope to share the content to help you, more related knowledge, 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