How to create a shortcut command for LINUX

Nice to meet you, this is MJ! This is Qiita's first post! Isn't it troublesome to move between folders when developing with LINUX? Perhaps most people find it a hassle. Specifically, what kind of situation is it?

home
   ├ task ─ app
   ├ task2    ├ Controller
              ├ Model
              ├ View

For example, suppose you have a folder hierarchy like this.

cd /home/task/app/Controller
cd /home/task/app/Model

You have to enter the command like this every time. This time, I will write a method to greatly reduce this troublesome work with just one effort!

home
   ├ task ─ ─ ─ ─ ─ ─app
   ├ task2             ├ Controller
   ├ .bash_profile     ├ Model
                       ├ View

Create a .bash_profile file in a hierarchy shallower than the project file you are using.

/home


vi .bash_profile

.bash_profile


alias cont='cd ~/home/task/app/Controller'
alias model='cd ~/home/task/app/Model'
alias web='vi ~/home/task/app/Controller/abcController.php'

By writing like this, if you type cont, you can execute the command on the right side of = and go to the controller file. In short, write the abbreviated name on the left and the command you want to execute on the right! After writing the command, execute the following command in the folder where .bash_profile is located.

source .bash_profile

That's it! By the way, don't forget to execute the last source command every time you log in!

I'll leave it around here this time! It's hard to understand in the first post, but thank you for reading! I would like to continue posting in the future!

Recommended Posts

How to create a shortcut command for LINUX
How to create a local repository for Linux OS
Try to create a new command on linux
[Go] How to create a custom error for Sentry
Command to create Linux Live USB
How to create a Conda package
How to create a Dockerfile (basic)
How to create a config file
How to create a SAS token for Azure IoT Hub
How to create a clone from Github
How to create a git clone folder
How to create * .spec files for pyinstaller.
[Linux] How to use the echo command
How to use the Linux grep command
How to install Windows Subsystem For Linux
How to create a repository from media
[C language] [Linux] Try to create a simple Linux command * Just add! !!
How to create a label (mask) for segmentation with labelme (semantic segmentation mask)
How to output the output result of the Linux man command to a file
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
How to create a Python virtual environment (venv)
How to create a function object from a string
How to create a JSON file in Python
Use click to create a sub-sub command --netsted sub-sub command -
How to write a ShellScript Bash for statement
[Note] How to create a Ruby development environment
Linux command for self-collection
How to create a Kivy 1-line input box
How to create a multi-platform app with kivy
Linux command line shortcut
How to create a Rest Api in Django
Create a command to get the work log
[Note] How to create a Mac development environment
What I learned by implementing how to create a Default Box for SSD
Read the Python-Markdown source: How to create a parser
Create a dataset of images to use for learning
How to create an article from the command line
[For beginners] How to use say command in python!
How to write a GUI using the maya command
How to create a submenu with the [Blender] plugin
Create a QR code for the URL on Linux
How to install Linux on a 32bit UEFI PC
Linux user addition, how to use the useradd command
How to build a development environment for TensorFlow (1.0.0) (Mac)
How to create a simple TCP server / client script
[Python] How to create a 2D histogram with Matplotlib
How to execute a command using subprocess in Python
(Remember quickly) How to use the LINUX command line
How to build a Python environment on amazon linux 2
How to create a kubernetes pod from python code
[Linux] How to put your IP in a variable
A super introduction to Linux
How to call a function
How to hack a terminal
Made a command for FizzBuzz
Linux Command Dictionary (for myself)
linux: create original Terminal command
Linux command memorandum [for beginners]
How to create a USB that Linux and Win10 installer and winpe can boot UEFI
How to execute sleep command, command that takes time as a test [bash, linux, mac]
A memo on how to easily prepare a Linux exercise environment