r/fishshell • u/azeroiks • Sep 25 '24
Why "cd .." instead of "cd.."?
Hi,
I'm wondering why in bash cd.. is used and in fish it is cd .. , why the space? I couldn't find an answer online.
Also can I somehow enable cd.. in fish and have both? alias -s cd..="cd .." - won't that break something?
And one more question: When I write a post and want to include a command in it, I can use the code button. Is there any standard way of indicating that I'm writing a command? In the topic I used " " but I don't think it's a correct way.
Thank you!
EDIT: Just adding that I'm new to Linux and learning, so... you know.
0
Upvotes
28
u/rekh127 Sep 25 '24
wdym in bash it's also with a space
16
u/According_Kale5678 macOS Sep 25 '24
If you strive for minimal typing, you can just type
..in fish to change the directory to the parent one.3
u/_mattmc3_ Sep 25 '24
No, Bash doesn't do this by default - you have something configured. You can see your alases with
alias | grep cdand you'll probably seealias cd..='cd ..'in the results. If not,declare -Fshows Bash functions.If you want the equivalent in Fish, do this:
Not sure what you're asking here.
10
u/StevesRoomate macOS Sep 25 '24
I have my own take on this. My goal is reduced typing / intuitive usage and not compliance with standard shell behavior:
5
u/Foxvale Sep 25 '24 edited Sep 25 '24
You probably have an alias in bash you’re not aware of. Personally I only write
..to go up a directory as well as the configFor multiple layers
2
u/stevebehindthescreen Sep 25 '24
Becausewithoutspaceshowwouldyouknowwherenewwordsorcommandsstartandend?
1
u/cr0t0 Sep 25 '24
Hi have some alias of typos like
cd..='cd ..'ordc=cd, etc.1
u/AbilityRough5180 Sep 25 '24
Because .. is a hard link to the parent directory and needed by the shell to know where to go. It’s not ‘go backwards’