My PC is a Mac. The OS uses MacOS. You can use Linux commands in the terminal as well as Linux OS. The shell was zsh. You can see the shell you are using by typing ʻecho $ 0` in the terminal. I thought it was using bash, but it was zsh.
I learned the difference between bash and zsh by checking the link below. -Difference between bash and zsh
I've been using Linux commands for some reason, but what if I'm using MacOS but LinuxOS in the first place? I was wondering while I was investigating, so I investigated. It seems that the commands in the terminal are almost the same as the Linux OS. The following link has solved my question quite a bit. -What is Linux -How to use the terminal
In this article, I have verbalized Linux commands for output. It's almost for my own learning. We would appreciate it if you could correct any mistakes.
・ Tab key
Input completion is possible. If you press the tab key
again, the candidates will be displayed.
・ Control + r
Find the command you used before. In addition, control + r
will display the second one when multiple searches are being performed.
・ Control + c
You can safely end the command you are currently typing.
・ Cd -
Change to the previous directory.
・ Cd ..
Move to the directory one level higher.
・ Cp -r
Recursively copy the directory. Recursive means looking at the directories and files inside. Perhaps.
Reference site: What is recursive?
-Cp file name copy destination
You can copy the file.
・ Mv
You can move directories and files.
・ Mv file name changed file name
You can change the file name of the current directory.
・ Ls -R
Recursively displays directories and files in the hierarchy below the current directory.
Reference site: What is recursive?
・ Mkdir
Create a directory.
・ Touch
Create a file.
Reference site: Create new file
・ Rmdir
You can delete an empty directory.
If there is content, you can delete it with rm -r
.
・ Ls
Displays the directories and files directly under the current directory.
・ Mv
Move directories and files.
・ Cat
You can display the contents of the specified file.
・ Less
This command can be used when the contents are long. It will display the contents. control + f
1 screen ahead control + b
1 screen front g
Move to the top of the screen G
End of q
less
・ History
You can see the history of commands. You can call and execute a command with the number displayed by ! + history
. You can also execute the previous command with !!
. With ! -2
, you can execute the previous command.
・ ! $
You can call the argument (character string) passed just before.
Assuming you were running the ls command before, you can type ! L
to run the ls command you just used. If you had previously executed the pwd command, you can use ! P
or! Pw
to execute the previously used pwd command.
To see the last command you used without running it, type ! L
followed by: p
. Then, it will be displayed without executing the ls command used immediately before. If it is ! Pw: p
, it will be displayed without executing the pwd command used immediately before.
If you enter !!
after ! Pw: p
, the displayed pwd command will be executed.
--[Linux Command Reference] (http://www.redout.net/data/command.html) -[Difference between command kill and control L] (https://qiita.com/ToshioAkaneya/items/663a4f19cad1ffbffd79) -Vim course starting from knowledge 0
Thank you for reading this article.
Twitter: @SHUN15949496
Recommended Posts