Skip to main content

All Questions

Tagged with
2 votes
2 answers
956 views

Why do I have to use this command twice to execute it?

I made an alias alias goto="cd $@ && source ~/.zshrc" and it works, but only if I execute it twice. Even after I execute it twice in one shell, and if I want to move to another dir, ...
Leo1807's user avatar
  • 23
3 votes
3 answers
3k views

How to create bash alias on Ubunth WSL when username has space and apostrophe

I'm trying to create the following alias in Ubuntu WSL: alias windocs='cd /mnt/c/Users/Firstname L'astname/Documents/' My username is unfortunately Firstname L'astname, including the space and ...
Joshua O'Reilly's user avatar
1 vote
1 answer
2k views

Shell Script To CD and Run a Python Script

OK, I know that there is a lot like this question but I literally get nothing. The thing i need is a script that cd's to /home/project then runs python3 pyscript.py I created an alias to cd alias name=...
akkaygin's user avatar
6 votes
3 answers
6k views

-bash: /bin/cd: No such file or directory - automatically execute ls after cd

I accidentially destroyed my cd command. I tried to automatically execute ls after cd is called. I found a post saying that I have to execute alias cd='/bin/cd && /bin/ls', but now I get -...
Black's user avatar
  • 2,098
0 votes
1 answer
51 views

Alias CD to a directory that's name is included in current directory

I've been using cmake and creating a build folder for my cmake code and I want to easily cd to the build directory. I've been naming my build directory in this format: /parent/codeandsuch /parent/...
saphire121's user avatar
3 votes
3 answers
12k views

Create alias for desktop directory

If I type in cd Desktop, no matter what folder the terminal is currently open in, I want it to navigate to /home/bob-ubuntu/Desktop In my .bashrc file I have the following lines at the bottom: alias ...
K Split X's user avatar
  • 1,763
36 votes
4 answers
63k views

Alias to CD in a directory and call a command

I have a .bash_profile and in that I have a set of aliases. Those aliases at the moment execute only a single command and it was fairly easy. I would however like to do two things with a new alias ...
user232103's user avatar
2 votes
1 answer
52 views

Create shorcuts in a terminal to navigate between folders [duplicate]

I am looking a way to create shortcuts for the cd command. My goal is to go quickly to distant folders. I have a new (big) drive which is not in my /home folder (but in /media/user/xxX/yyy/) and I ...
ppr's user avatar
  • 1,917
2 votes
2 answers
2k views

How to define alias only for some directory? [duplicate]

I want to define some alias iex="iex -S mix" only for one directory - this alias should work only when I cd'ed to this directory. Another requirement - this functionality should be placed inside this ...
Alex Antonov's user avatar
1 vote
1 answer
3k views

alias to make a new directory and go to it [duplicate]

So here I've created, or at least tried to create an alias for a command that accepts a command-line argument, makes a new directory with that name, and goes to it. alias newfolder='mkdir $2 ; cd "$(...
Galaxy's user avatar
  • 505
0 votes
2 answers
333 views

why does /var/mail/{username} = /Users/{username}?

My basic question is why do both of these paths point to home (i.e., ~)? Is it pointing to the same home or is it duplicated? I doubt it's duplicated, so if not, how does cd .. decide which directory ...
Eduardo Moreno's user avatar
4 votes
1 answer
3k views

How to declare some aliases dynamically in zsh?

I would like to declare a few shortcut commands to switch between my various coding projects, so I have come up with the following script. projects=$(ls -d ~/Workspace/*/) prefix="/Users/myuser/...
le-doude's user avatar
  • 143
2 votes
1 answer
1k views

ls after cd in tcsh?

I cannot seem to find an answer to this question. In my .bash_profile I have this line: cd() { builtin cd "$@"; ll; } which executes ll every time I change directories. I would like this ...
AustinM's user avatar
  • 23
3 votes
2 answers
1k views

How to create hyphen alias for zsh?

I am using zsh and oh-my-zsh on Ubuntu. To change into the recent directory in the past there was an alias set to - which is the same as cd -. Somehow the alias disappeared at my machine. This might ...
JJD's user avatar
  • 587
6 votes
4 answers
20k views

Command line shortcuts for changing directory [duplicate]

I'm looking for an easy way to navigate to directories spanning multiple hard drives and want to set something equivalent to a shortcut within the terminal. In Windows I would accomplish this with ...
user1695505's user avatar
2 votes
1 answer
5k views

How can I write an alias for cd such that it will fire ls after going into the directory to which I just cd'ed into? [duplicate]

Lets say I want to do cd home and then ls -lrth. I want these two things combined into a single command. I tried writing an alias, but it didnt work. Can you help me ?
Chani's user avatar
  • 418
8 votes
2 answers
24k views

Creating an alias to Change Directory and have that directory be the current working directory in new terminal tabs

I'm trying to create a convenience alias that will change directories and then start a node server in that directory. I have it working for the most part, there's just one little issue that I can't ...
Scott's user avatar
  • 181
21 votes
4 answers
3k views

Automatically detect when I typed "vi" but meant "cd"?

About 5 times a day, I type "vi" when I meant "cd", and end up opening a directory in vi. It's making me NUTS. It seems like there should be a way to detect when I type in "vi + directory" and ...
Alex's user avatar
  • 323
8 votes
4 answers
9k views

How to create a short path?

We have so many useful folders, which are in different path, for our working in Linux. For example : $ cd ~/Documents/Courses/EDX/physics2013/ $ cd ~/Documents/Company/OpenGL/Proj/... $ cd ~/...
Gapry's user avatar
  • 245
4 votes
4 answers
837 views

Simplified navigation in terminal

I know IDEs are the wave of the future, but I always find myself coding in vim in a Linux terminal. Old dog. New tricks. Anyway, navigation becomes challenging when dealing with long package names. ...
rouble's user avatar
  • 2,001
3 votes
2 answers
2k views

Can I run a command after the user uses Ctrl-C to kill a command?

So at my position we use a shared set of aliases to do builds. Something like... alias 'build'='cd $BUILD_ROOT; m; cp ...; cp...; deploy; deploy; deploy; cd -' This is super irritating because the ...
Hounshell's user avatar
  • 303
3 votes
2 answers
174 views

How can I create a "base" for other aliases to refer to and enable cd base/x command directories?

I have .bash_aliases with: alias c1='cd /home/me/code/php' alias c2='cd /home/me/code/jquery' alias c3='cd /home/me/code/ruby' alias c4='cd /home/me/code/c' How can I DRY this up and loosen the ...
Michael Durrant's user avatar
2 votes
1 answer
1k views

How can I add an alias for my pwd to an existing file?

I want to add another alias to my "aliases" file for the directory I'm currently in (Present Working Directory) I've tried printf "alias aaa=cd " + pwd >> myfile It's close, but I end up ...
Michael Durrant's user avatar
134 votes
36 answers
73k views

Quick directory navigation in the bash shell

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/. But I don't want to type cd /[full-path]/...
saiy2k's user avatar
  • 1,603
20 votes
2 answers
11k views

Change directory without typing cd?

Is it possible to make bash change directory in command line simply by typing that directory without any commands like cd? For example is it possible instead of writing this: $ cd /tmp I just want ...
Vladimir's user avatar
  • 310