In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the bd command in Linux to quickly return to a specific parent directory, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
What is the bd command?
The bd command allows the user to quickly return to the parent directory in Linux instead of typing cd.. /.. repeatedly.
You can list the contents of a given directory without providing the full path ls bd Directory_Name. It supports the following other commands, such as ls, ln, echo, zip, tar, etc.
In addition, it allows us to execute the shell file without providing the full path bd p/shell_file.sh.
How do I install the bd command in Linux?
With the exception of Debian/Ubuntu, bd has no official distribution. Therefore, we need to execute the method manually.
For Debian/Ubuntu systems, use the APT-GET command or the APT command to install bd.
$sudo apt install bd
For other Linux distributions, download the bd executable binaries using the wget command.
$sudo wget-- no-check-certificate-O / usr/local/bin/bd https://raw.github.com/vigneshwaranr/bd/master/bd
Sets executable permissions for bd binaries.
$sudo chmod + rx / usr/local/bin/bd
Add the following values to the .bashrc file.
$echo 'alias bd= ".bd-si" > ~ / .bashrc
Run the following command for the changes to take effect.
$source ~ / .bashrc
To enable autocompletion, perform the following two steps.
$sudo wget-O / etc/bash_completion.d/bd https://raw.github.com/vigneshwaranr/bd/master/bash_completion.d/bd $sudo source / etc/bash_completion.d/bd
Now that we have successfully installed and configured the bd utility on our system, it is time to test it.
I will test using the directory path below.
Run the pwd command or the dirs command, or the tree command to learn about your current path.
Daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ pwd or daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ dirs / usr/share/icons/Adwaita/256x256/apps
I'm in the / usr/share/icons/Adwaita/256x256/apps directory now, and if I want to jump to the icons directory quickly, just type the following command.
Daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ bd icons/usr/share/icons/daygeek@Ubuntu18:/usr/share/icons$
You can even enter a few letters without entering the full directory name.
Daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ bd iUnix Ubuntu 18mm Ubuntu Ubuntu 18mm Ubuntu Ubuntu 18A Ubuntu Ubuntu 18A
Note: if there are multiple directories with the same name in the hierarchy, bd will take you to the nearest directory. (do not consider the direct parent directory)
If you want to list the contents of a given directory, use the following format. It prints out the contents of / usr/share/icons/.
$ls-lh `bd icons` or daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ ls-lh `bd i`total 64Kdrwxr-xr-x 12 root root 4.0K Jul 25 2018 Adwaitalrwxrwxrwx 1 root root 51 Feb 25 14:32 communitheme-> / snap/communitheme/current/share/icons/communithemedrwxr-xr-x 2 root root 4.0K Jul 25 2018 defaultdrwxr-xr-x 3 root root 4.0K Jul 25 2018 DMZ-Blackdrwxr-xr-x 3 root root 4.0K Jul 25 2018 DMZ-Whitedrwxr-xr-x 9 root Root 4.0K Jul 25 2018 gnomedrwxr-xr-x 3 root root 4.0K Jul 25 2018 handheldsdrwxr-xr-x 20 root root 4.0K Mar 9 14:52 hicolordrwxr-xr-x 9 root root 4.0K Jul 25 2018 HighContrastdrwxr-xr-x 12 root root 4.0K Jul 25 2018 Humanitydrwxr-xr-x 7 root root 4.0K Jul 25 2018 Humanity-Darkdrwxr-xr-x 4 root root 4.0K Jul 25 2018 locolordrwxr-xr-x 3 root root 4.0K Feb 25 15:46 LoginIconsdrwxr-xr-x 3 root root 4 .0K Jul 25 2018 redglassdrwxr-xr-x 10 root root 4.0K Feb 25 15:46 ubuntu-mono-darkdrwxr-xr-x 10 root root 4.0K Feb 25 15:46 ubuntu-mono-lightdrwxr-xr-x 3 root root 4.0K Jul 25 2018 whiteglass
If you want to execute the file somewhere in the parent directory, use the following format. It will run the shell file / usr/share/icons/users-list.sh.
$`bd i` / users-list.sh or daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ `bd icon` / users-list.shdaygeekthanurenu2gadmintestuserdemousersudhasureshuser1user2user3
If you are in / usr/share/icons/Adwaita/256x256/apps and want to navigate to a different parent directory, use the following format. The following command navigates to the / usr/share/icons/gnome directory.
$cd `bd i` / gnome or daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ cd `bd icon` / gnomedaygeek@Ubuntu18:/usr/share/icons/gnome$
If you are at / usr/share/icons/Adwaita/256x256/apps, you want to create a new directory under / usr/share/icons/, using the following format.
$daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ sudo mkdir `bd icons` / 2g daygeek@Ubuntu18:/usr/share/icons/Adwaita/256x256/apps$ ls-ld `bd icon` / 2gdrwxr-xr-x 2 root root 4096 Mar 16 05:44 / usr/share/icons//2g Thank you for reading this article carefully. I hope the article "how to use the bd command in Linux to quickly return to a specific parent directory" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.