A shell is a program that interprets and executes commands. Work on linux system is done on the termimnal.
A program(shell) that interprets and executes commands to be entered for each terminal when loggin in to the linux system. It starts to work. There are several kind of shells, and users can select a shell to execute according to their preference.
mount -r /ev/cdrom /media/cdrom
mount is a command to do or mount work which embeds a disk device in the directory of Linux and makes it usable.
Today, the disk device ranges from CD, DVD, Blue-ray Disc, external hard disk, USB memory and so on. Disk devices are called file systems on Linux. All of them can be set to be usable with the mount command.
Basic of “mount”
The way to check the current mounting status is easy as follows.
mount
[vagrant@localhost tests]$ mount /dev/mapper/VolGroup-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw) /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) vagrant on /vagrant type vboxsf (uid=500,gid=500,rw)
The current mounting status is displayed. Information on where called a mount point is located, the type of the file system whether other read / write is possible, and the like are displayed.
-r option: read-only
The -r option is an option to mount read-only and the format is as follows.
$mount -r -t ${type} ${device} ${mount directory}
The command to mount the device /dev/cdrom read-only on the mount point/media/cd is as follows.
$ mount -r -t iso9660 /dev/cdrom /media/cd
mount -r /dev/cdrom /media/cdrom
VBoxManage storageattach CentOS-6.4-x86_64-minimal
Assign virtual DVD drive
Like the virtual hard disk, assign a virtual DVD drive. The installation media specifies Cent-6.4- x86 – minimal.iso.
$ VBoxManage storageattach CentOS-6.4-x86_64-minimal --storagectl SATA --port 2 --type dvddrive --medium I:/ISO/CentOS/CentOS-6.4-x86_64-minimal.iso
$ VBoxManage storageattach ${guest-os} \ --storagectl IDE \ --port 1 \ --device 0 \ --type dvddrive \ --medium ${iso}
yum update kernel
[vagrant@localhost tests]$ uname -a Linux localhost.localdomain 2.6.32-754.3.5.el6.x86_64 #1 SMP Tue Aug 14 20:46:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ssh -p “port”
ssh -p port
specify the port to connect to the remote host. This can also be specified for each host depending on the configuration file.
VBoxManage controlvm “guest OS”
Operate specified guest OS
%VBoxManage controlvm "guest os" [ poweroff | savestate | reset | pause | resume ]
The second argument in controlvm specifies the control option
Added port forwarding settings from the command line in VirtualBox
VBoxManage controlvm "guest OS" natpf1 "nginx,tcp,127.0.0.1,8080,,80"
In this sample, port forwarding 8080 of localhost to port 80.
VBoxManage controlvm "guest OS" natpf1 ssh,tcp,,22022,,22
etc/sysconfig/network-scripts/ifcfg-eth0
The interface configuration file controls the software interface of individual network devices. The system uses these files at boot time to decide which interface to activate and how to configure. These files are usually named ifcfg-name. Name refers to the name of device controlled by the configuration file.
Ethernet interface
etc/sysconfig/network-scripts/ifcfg-eth0 is one of the most common interface files. It controls the system’s first Ethernet network interface card or NIC. In a system with multiple NICs, there are multiple ifcfg-ethx files. Because each device has its own configuration file, the administrator can control how each interface works separately.
[vagrant@localhost tests]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="dhcp" IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet"
何!?
onboot=”yes”
yes- the device must be activated at boot time.
no – this device does not need to be activated at boot time
sed -i -e "s/ONBOOT=no/ONBOOT=yes/" /etc/sysconfig/network-scripts/ifcfg-eth0
sed -e -i “s/hoge/foo/g” index.php
sed command
commands that can replace all strings, extract them on a line by row basis, delete them, and perform various text processing. Process contents can be specified by command line parameters, and batch processing can be done non-interactively.
-e: specify processing content
-i : replace the file without outputting the result.
echo "hoge";
[vagrant@localhost tests]$ ls index.php test [vagrant@localhost tests]$ sed -i -e 's/hoge/foo/g' index.php [vagrant@localhost tests]$ cat index.php echo "foo";
すげーーーーーーーーーーーー
making dfl
Assure Definitely making dfl every time.
“tree” | useful linux command for making directory configuration diagram
If you are in development project, occasionally there are cases to make directory charts, but if you use linux “tree” command, you can make it in short.
Really?
First of all, prepare for the simple files.
[vagrant@localhost tests]$ tree -d -bash: tree: コマンドが見つかりません
なにいいいいいいいいいいいいいいいいいいいいいいいい?
linuxでデフォルトで入ってるんちゃうんかい。。。
# sudo yum install tree インストール: tree.x86_64 0:1.5.3-3.el6 完了しました!
[vagrant@localhost tests]$ tree . ├── asset │ ├── css │ │ └── style.css │ └── js │ └── app.js └── index.php 3 directories, 3 files
ooooooooooooooooooooooooooo, shaddy!!!!!!!!!
[vagrant@localhost tests]$ git clone https://github.com/githubix/test.git Initialized empty Git repository in /home/vagrant/local/app/tests/test/.git/ remote: Enumerating objects: 42, done. remote: Counting objects: 100% (42/42), done. remote: Compressing objects: 100% (32/32), done. remote: Total 45 (delta 4), reused 4 (delta 0), pack-reused 3 Unpacking objects: 100% (45/45), done. [vagrant@localhost tests]$ ls index.php test [vagrant@localhost tests]$ tree . ├── index.php └── test └── test.php 1 directory, 2 files
すげーーーーーーーーーーーーーーーーーー
やべーーーーーーーーー
いや、待て。markdownの書き方だ。。うむーExcelか?