0

I wanted to create a directory and access it after creation in a single command chain using:

mkdir directory_name && cd directory_name

is there a better way to do it that is built-in in linux without the need of creating a function to achieve that?

to be able to make a directory and access it without repeating the directory name?

  • 2
    Possible duplicate of [How can I make my own "shell commands" (e.g. mkdir/cd combo)?](https://superuser.com/questions/1073869/how-can-i-make-my-own-shell-commands-e-g-mkdir-cd-combo) – Kamil Maciorowski Jan 31 '19 at 15:16
  • I didn't mean asking for a function to do it, what I meant was if there is something built-in in linux that can achieve that. – Mrwan Ashraf Jan 31 '19 at 15:18
  • On UNIX (Linux) you have many small tools that do **one** thing well. It is normal to combine these tools for more complex tasks, so what's the reason against using a function or script? – Bodo Jan 31 '19 at 15:33
  • @Bodo i could have made the script already without asking but i didn't want to reinvent the wheel so i wanted to make sure first if the solution I'm looking for exists, more like a terminal tip. – Mrwan Ashraf Jan 31 '19 at 15:37

1 Answers1

0

here is how to do it based on the answer i have found:

mkdir directory_name && cd "$_"