As I stated in the other comment, I had no idea cd - was a thing before reading the discussion. I can think of multiple different times I accidentally cded somewhere when I didn't want to and had to type everything out again. This is going to be a nice time saver!
Coding is as much a matter of personal growth as it is of logic and control-flow. I keep patience, curiosity, & exuberance in the same toolbox as vim and git. *Opinions posted are my own*
Great intro, I will definitely share this when asked.
Now if you want to go back to the directory you were in before ~/Development, you can use the command cd ... This command navigates up one directory.
TIL you can cd - to go back
cd Documents pwd /Users/bennyp/Documents cd pwd /Users/bennyp cd .. pwd /Users cd cd Documents pwd /Users/bennyp/Documents cd pwd /Users/bennyp cd - pwd /Users/bennyp/Documents
Coding is as much a matter of personal growth as it is of logic and control-flow. I keep patience, curiosity, & exuberance in the same toolbox as vim and git. *Opinions posted are my own*
One of my favourite aliases is hi=history | grep makes it super easy to get the commands I know have a certain string, be it the name of the command, a substring of a hostname or an argument to a command.
I'm planning on covering aliases in another blog post for this series! They are actually something relatively new to me, so thank you for introducing this one to me and adding to the discussion.
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Thank you for the article, Victoria. You and those who read this article might benefit from explainshell, a website where you can enter a shell command (with optional arguments) and it will explain to you what everything means.
Try it out by entering some command with arguments. :)
That link is absolutely amazing! I wish I would have known about it earlier. I'm going to edit the article and add it. Thank you so much for adding this to the discussion.
Great post :)
It's worth mentioning that you can create several nested directories with -p this way:
mkdir -p /dir1/dir2/dir3
Also, for creating multiple files you can use the following syntax:
touch file{1..3} which will create file1 file2 and file3
Thank you so much for adding these to the discussion!! I was not aware of these two little tricks.
Something super useful but not widely known, is " cd - "
// ~/
$ cd docks/proj/src/component
// ~/docks/proj/src/component
$ (something useful)
// ~/
$ cd -
Also, just "cd" is same as "cd ~" which brings you to the home dir.✔️
As I stated in the other comment, I had no idea
cd -
was a thing before reading the discussion. I can think of multiple different times I accidentallycd
ed somewhere when I didn't want to and had to type everything out again. This is going to be a nice time saver!Great intro, I will definitely share this when asked.
TIL you can
cd -
to go backI had no idea this existed! This is awesome. Thank you for sharing.
Yeah I literally looked it up today.
There's
pushd
andpopd
also, but I wanted something that works like the back button even if I hadnt pushed.Google brought me to unix.stackexchange.com/questions/8...
One of my favourite aliases is hi=history | grep
makes it super easy to get the commands I know have a certain string, be it the name of the command, a substring of a hostname or an argument to a command.
You can also use ! to execute specific command from the history list like !1986 where 1986 is the command ID Using history with grep and !
I'm planning on covering aliases in another blog post for this series! They are actually something relatively new to me, so thank you for introducing this one to me and adding to the discussion.
Thank you for the article, Victoria. You and those who read this article might benefit from explainshell, a website where you can enter a shell command (with optional arguments) and it will explain to you what everything means.
Try it out by entering some command with arguments. :)
That link is absolutely amazing! I wish I would have known about it earlier. I'm going to edit the article and add it. Thank you so much for adding this to the discussion.
cd
andls
are by far the two commands I use the most, especiallyls -la
Excelent introduction to cmd