Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
The history feature is great for remembering commands. Is there a feature that remembers recent directories?
I'd like to be able to search through a history of directories - it'd be even better if it was possible to bookmark and name them, as you can do in a browser.
You can do cd -1 to get back to the previous directory, cd -2 to get to the former etc.. You can also refer to them using ~1, like cp ~1/README.md ~2/
For a more advanced use, you can use the dirs builtin. You can also use pushd and popd to stack up directories and get back to them later on, pretty useful in scripts.
cf the directory stack
Zsh has the same facility, the dirstack. And with zsh, you can have more fun with directory bookmarks,
Finally, there's even a crazy guy who implemented a GUI for listing the dirstack. Not sure how useful that can be, but it's definitely crazy enough to be referred :-)
HTH
To save directories and keep a historial, you can try pushd and popd from bash
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I come from MS-DOS background, where it is permitted to type cd.. (without the space between cd and ..) instead of cd ... The Linux terminal, however, finds cd.. objectionable.
Is there a way to make Linux terminal understand cd.. to mean cd ..?
I'm using Ubuntu.
And I am well aware that this is a rather silly problem, but I have cd.. committed to muscle memory (since early childhood, my brain has been wired that way) and I've been making that mistake at least twenty times every day, for several years now, ever since I started using Linux on a regular basis.
You could create an alias:
alias cd..="cd .."
If you add this to some file that's loaded whenever you log in (e.g., .bashrc if you're using bash), you'd get the effect of having this alias permanently available.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm preparing a batch compiling sh file in Ubuntu. It is using dir command to get a list of files (and some string processing to extract names). But this may not be the best way (but easy enough) of getting list.
Question: do all Linux distros answer "dir" command same?
dir /usr/lib/nvidia-*
/usr/lib/nvidia-396:
alt_ld.so.conf libnvidia-cfg.so.396.54
bin libnvidia-compiler.so
ld.so.conf libnvidia-compiler.so.1
libEGL_nvidia.so.0 libnvidia-compiler.so.396.54
Yes, the dir tool should work the same across any distribution, provided the distribution doesn't have its own modified version or has this tool missing etc.
You might find this helpful for some background into dir tool
https://www.howtoforge.com/linux-dir-command/
You can use tree command to get all files and filter whatever you want.
tree -f -i .|grep .*\.py$ here it greps all .py files.
here's tree doc
example:
root#fdada3432377:/usr/src/app# tree -f -i conn* |grep .*\.py$
connection/__init__.py
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
Well, I know you have to use -r with cp and rm when dealing with directories. It makes this job recursively (meaning it coping and removing all starting with things inside).
But why you dont do "mv -r" when moving / renaming directories?
Directories are just collections of pointers to locations of files on the filesystem. When you move a directory you are updating the file pointers of the new and old parents to contain/remove the one you moved. Thus, child file pointers inside do not require recursive action as none of the pointer locations have actually changed for them.
EDIT: I've just found a much more detailed answer on Unix & Linux StackExchange that will help explain this further.
https://unix.stackexchange.com/questions/46066/why-unix-mv-program-doesnt-need-r-recursive-option-for-directories-but-cp-do
For every move, new location is needed.
If one wants to move all files under directory alongwith the directory, just move the directory which is recursive.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I just began to learn to use Linux but I am just curious what would be the purpose of this command as it really doesn't do anything from what I have learned.
The point of the cd . command is to not create special cases merely because they are pointless.
The cd command is useful. Having a relative path that always means "the current directory" is useful. This means that the cd . command is possible.
At this point there are two options. Either create a special case disallowing it, or accept that freedom to cd anywhere also means the freedom to cd to where you already are, and accept it as harmless.
Unix, wisely, chose the later.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Suppose I have a directory on my disk that has the name: photos_with_my_friend_John_from_first_semester_of_my_graduation_year
Now each time I want to enter this directory I must write the following command:
cd photos_with_my_friend_John_from_first_semester_of_my_graduation_year
I am new to linux and for me it is very boring to write this whole name each time I want to deal with this directory or any other directory or file that has such a long name. So is there an alternative easy way to do this?
Most shells offer tab completion: You simply type cd phot and hit Tab, and it'll insert the rest for you (assuming the prefix is unique).
How about using wildcards? Say photos*John*graduation etc.?
You can create a symbolic link for ease of access:
ln -s long_file_name short_file_name
then you can use short_file_name as you wish.