Fortunately, I have been involved in data analysis in my work since December. However, as I have more opportunities to use Linux commands, I have summarized them for review. I will refer to the course of dot installation. I can't believe this is free, but ...
https://dotinstall.com/lessons/basic_unix_v2
Use on CentOS, a local development environment
↓ How to set up the environment https://dotinstall.com/lessons/basic_localdev_win_v2
[vagrant@localhost ~]$ pwd
/home/vagrant
[vagrant@localhost ~]$ pwd
/home/vagrant
[vagrant@localhost ~]$ cd unix_lessons/
[vagrant@localhost unix_lessons]$ pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ cd ..
[vagrant@localhost ~]$ pwd
/home/vagrant
[vagrant@localhost unix_lessons]$ pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ cd ..
[vagrant@localhost ~]$ pwd
/home/vagrant
[vagrant@localhost ~]$ cd -
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ ls myapp/
hello.txt
[vagrant@localhost unix_lessons]$ cd !$
cd myapp/
[vagrant@localhost myapp]$
Successful move to myapp
[vagrant@localhost unix_lessons]$ mkdir myapp
[vagrant@localhost unix_lessons]$ ls
myapp
cp [File to copy] [Destination]
Copy myapp to myapp2 in the same directory
[vagrant@localhost unix_lessons]$ cp -r myapp myapp2
[vagrant@localhost unix_lessons]$ ls
myapp myapp2
cp [file to copy]. Copy to the same directory
Requires "-r" option when copying directories
$ cp -r ./foo /home/hoge/aaa
If you want to keep the attributes of the copy source, also use the "-p" option.
$ cp -rp ./foo /home/hoge/aaa
mv [File to move] [Destination]
Move myapp3 files to the lower level of myapp2
[vagrant@localhost unix_lessons]$ ls
myapp myapp2
[vagrant@localhost unix_lessons]$ mkdir -p myapp3/config
[vagrant@localhost unix_lessons]$ ls
myapp myapp2 myapp3
[vagrant@localhost unix_lessons]$ ls myapp3
config
[vagrant@localhost unix_lessons]$ mv myapp3 myapp2
[vagrant@localhost unix_lessons]$ ls myapp2
myapp3
rmdir [filename you want to delete]
[vagrant@localhost unix_lessons]$ ls myapp3
config
[vagrant@localhost unix_lessons]$ rmdir myapp2/myapp3/config
[vagrant@localhost unix_lessons]$ ls myapp2/myapp3
[vagrant@localhost unix_lessons]$ rmdir myapp2
rmdir: failed to remove `myapp2':Directory is not empty
[vagrant@localhost unix_lessons]$ rm -r myapp2
[vagrant@localhost unix_lessons]$ ls
myapp
[vagrant@localhost unix_lessons]$ cat ./myapp/hello.txt
・ You can check the contents of the file
Usage is different from cat
・ Arrow: Scroll ・ Space / Ctrl + F One screen ahead ・ Ctrl + B one screen before ・ Move to the beginning of g ・ Shift + g Move to the end ・ Q end ・ / [Search term](n: next Shift + n: previous)
If you want to execute the command in the list, you can execute it with![Arbitrary number].
[vagrant@localhost unix_lessons]$ !pw ← Execute the command starting with pw most recently
pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ !pw:p ← Ayafuyara:Only display with p is possible
pwd
[vagrant@localhost unix_lessons]$ !!← Execution
pwd
/home/vagrant/unix_lessons
[vagrant@localhost unix_lessons]$ mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create a directory. However, if the directory already exists, nothing is done.
Required arguments for long options are also required for short options.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z, --context=CTX set the SELinux security context of each created
directory to CTX
When COREUTILS_CHILD_DEFAULT_ACLS environment variable is set, -p/--parents
option respects default umask and ACLs, as it does in Red Hat Enterprise Linux 7 by default
--help Show this usage and exit
--version Display version information and exit
Report mkdir bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report mkdir translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'mkdir invocation'
vim
vim has a command mode and an edit mode. Edit mode if "INSERT" is displayed at the bottom left.
〇 Command mode ⇒ Edit mode: i 〇Edit mode ⇒ Command mode: Esc
To exit / save, use command mode : w Save : q end : q! Discard changes and exit
〇 Launch a virtual machine with Windows PowerShell
PS C:\Users\takuy> cd MyVagrant/MyCentOS
PS C:\Users\takuy\MyVagrant\MyCentOS> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' version '2.3.4' is up to date...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
PS C:\Users\takuy\MyVagrant\MyCentOS> vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
〇 Load MyCentOS created with PuTTy Username and pass are vagrant
〇Exit command on PuTTy
〇 Stop the virtual machine on Powershell
PS C:\Users\takuy\MyVagrant\MyCentOS> vagrant suspend
==> default: Saving VM state and suspending execution...
・ Http://www.koikikukan.com/archives/2016/02/09-000300.php
Recommended Posts