--This is a volume to try to create a new command on linux.
What does the new command mean?
You can create a " newfile.txt "
file by typing the newfile
command.
――How does it work?
Use the alias command.
newfile
commandtouch newfile.txt
behind the scenes" newfile.txt "
file.--Registration command
alias Alias command='command'
--Delete command
unalias alias command
Please note that alias is reset when you close the terminal screen or log out.
--Registration
alias newfile='touch newfile.txt'
--Registration confirmation
$ alias | grep newfile
==========
alias newfile='touch newfile.txt'
==========
I was able to register!
--Execute
$ ls
(Nothing was returned)
$ newfile
$ ls
newfile.txt
newfile.txt
was done!
--Registration
vi ~/.bashrc
==========
add to
alias newfile='touch newfile.txt'
==========
--Login again
exit
--Registration confirmation
$ alias | grep newfile
==========
alias newfile='touch newfile.txt'
==========
I was able to register!
--Execute
$ ls
(Nothing was returned)
$ newfile
$ ls
newfile.txt
newfile.txt
was done!
--Registration confirmation
$ alias | grep newfile
==========
alias newfile='touch newfile.txt'
==========
unalias newfile
--Confirmation of deletion
$ alias | grep newfile
(Nothing is returned)
--Registration confirmation
$ alias | grep newfile
==========
alias newfile='touch newfile.txt'
==========
--Temporary deletion
unalias newfile
--Confirmation of deletion
$ alias | grep newfile
(Nothing is returned)
--Registration confirmation
$ alias | grep newfile
==========
alias newfile='touch newfile.txt'
==========
vi ~/.bashrc
==========
Delete
alias newfile='touch newfile.txt'
==========
--Login again
exit
--Confirmation of deletion
$ alias | grep newfile
(Nothing is returned)
-You can also create new commands! Alias command detailed summary [Linux command collection] -Command alias reintroduction to make commands convenient
Recommended Posts