In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How do I enter a directory or folder in Linux? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Shopt is a shell built-in command to set and unset various bash shell options, and since it is already installed, we do not need to install it again.
Yes, we can switch directories without using the cd command when this option is enabled.
We will show you how to do this in this article. This is a small adjustment, but it is very useful for beginners who migrate from Windows to Linux.
This doesn't work for Linux administrators because we don't change to that directory without the cd command, because we have experience with it.
If you try to switch between Linux directories / folders without the cd command, you will see the following error message. This is common in Linux.
$Documents/bash: Documents/: Is a directory
To do this, we need to append the following values to user .bashrc.
What is .bashrc?
.bashrc is a shell script that runs each time a user opens a new shell in interactive mode.
You can add any command you want to enter at the command prompt to this file.
The .bashrc file itself contains a series of configurations for the terminal session. Including setting and enabling: shading, completion, shell history, command aliases, etc.
$vi ~ / .bashrc
Join the business:
Shopt-s autocd
Run the following command to make the changes take effect.
$source ~ / .bashrc
We have completed all the configurations. Simply test this to see if it works.
Documents/cd-- Documents/$ daygeek/cd-- daygeek/$ / home/daygeek/Documents/daygeekcd-- / home/daygeek/Documents/daygeek$ pwd/home/daygeek/Documents/daygeek
Yes, it works as expected.
Also, it works fine in fish shell without any changes to .bashrc.
If you want to do this temporarily, use the following command (set or unset). When you restart the system, it will disappear.
# shopt-s autocd# shopt | grep autocdautocd on# shopt-u autocd# shopt | grep autocdautocd off
The shopt command provides many other options, and if you want to verify them, run the following command.
Shoptautocd onassoc_expand_once offcdable_vars offcdspell oncheckhash offcheckjobs offcheckwinsize oncmdhist oncompat31 offcompat32 offcompat40 offcompat41 offcompat42 offcompat43 offcompat44 offcomplete_fullquote ondirexpand offdirspell offdotglob offexecfail offexpand_aliases onextdebug offextglob offextquote onfailglob offforce_fignore onglobasciiranges onglobstar offgnu_errfmt offhistappend onhistreedit offhistverify offhostcomplete onhuponexit offinherit_errexit offinteractive_comments onlastpipe offlithist offlocalvar_inherit offlocalvar_unset offlogin_shell offmailwarn offno_empty_cmd_completion offnocaseglob offnocasematch offnullglob offprogcomp onprogcomp_alias offpromptvars onrestricted_shell offshift_verbose offsourcepath onxpg_echo off after reading the above, do you know how to enter a directory or folder in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.