GNU Compiler Collection
gcc is a compiler developed and published by the GNU project. It is packaged with compilers of various programming languages. It is standardly used in many UNIX based OSs, and in open source OS, it is often used for compiling OS itself.
Category: Linux
kernel-devel
kernel-devel is necessary to build modules such as devices
On CentOS(rpm-based OS), install Linux Kernel-devel with consistency with kernel
By the way, kernel-devel seems to contain the minimum source necessary for building modules
[vagrant@localhost ~]$ rpm -qa | grep kernel
kernel-devel-2.6.32-754.2.1.el6.x86_64
kernel-2.6.32-754.3.5.el6.x86_64
kernel-firmware-2.6.32-754.3.5.el6.noarch
dracut-kernel-004-411.el6.noarch
kernel-headers-2.6.32-754.3.5.el6.x86_64
kernel-devel-2.6.32-754.3.5.el6.x86_64
kernel-2.6.32-754.2.1.el6.x86_64
kernel-2.6.32-642.el6.x86_64
kernel-devel, kernel-headers ともに入ってますね。
kernel-headers
A C language header file related to the kernel is packaged.
It is necessary for rebuilding the kernel and compiling system related programs.
[vagrant@localhost ~]$ rpm -qi kernel-headers
Name : kernel-headers Relocations: (not relocatable)
Version : 2.6.32 Vendor: CentOS
Release : 754.3.5.el6 Build Date: 2018年08月15日 06時04分13秒
Install Date: 2018年10月07日 19時48分45秒 Build Host: x86-01.bsys.centos.org
Group : Development/System Source RPM: kernel-2.6.32-754.3.5.el6.src.rpm
Size : 2776586 License: GPLv2
Signature : RSA/SHA1, 2018年08月15日 10時59分21秒, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem
URL : http://www.kernel.org/
Summary : Header files for the Linux kernel for use by glibc
Description :
Kernel-headers includes the C header files that specify the interface
between the Linux kernel and userspace libraries and programs. The
header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
glibc package.
ん? Linux kernelのことか?
[vagrant@localhost ~]$ rpm -ql kernel-headers | more
/usr/include/asm
/usr/include/asm-generic
/usr/include/asm-generic/auxvec.h
/usr/include/asm-generic/bitsperlong.h
/usr/include/asm-generic/errno-base.h
/usr/include/asm-generic/errno.h
/usr/include/asm-generic/fcntl.h
/usr/include/asm-generic/int-l64.h
/usr/include/asm-generic/int-ll64.h
/usr/include/asm-generic/ioctl.h
/usr/include/asm-generic/ioctls.h
/usr/include/asm-generic/ipcbuf.h
/usr/include/asm-generic/mman-common.h
/usr/include/asm-generic/mman.h
/usr/include/asm-generic/msgbuf.h
/usr/include/asm-generic/param.h
/usr/include/asm-generic/poll.h
/usr/include/asm-generic/posix_types.h
/usr/include/asm-generic/resource.h
/usr/include/asm-generic/sembuf.h
/usr/include/asm-generic/setup.h
/usr/include/asm-generic/shmbuf.h
/usr/include/asm-generic/shmparam.h
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.
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";
すげーーーーーーーーーーーー
“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か?
ln -s
[vagrant@localhost tests]$ ls index.php test [vagrant@localhost tests]$ cat index.php <?php ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="tinymce/js/tinymce/tinymce.min.js"></script> <script> tinymce.init({ selector:"#tiny", // menubar: false, plugins: "textcolor image link", toolber: [ "undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent", "fontsizeselect forecolor image link" ], statusbar: false, }); </script> </head> <body> <textarea id="tiny" name=""></textarea> </body> </html> [vagrant@localhost tests]$ ln -s index.php copy [vagrant@localhost tests]$ ls copy index.php test [vagrant@localhost tests]$ cat copy <?php ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="tinymce/js/tinymce/tinymce.min.js"></script> <script> tinymce.init({ selector:"#tiny", // menubar: false, plugins: "textcolor image link", toolber: [ "undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent", "fontsizeselect forecolor image link" ], statusbar: false, }); </script> </head> <body> <textarea id="tiny" name=""></textarea> </body> </html>
すげーーーーーーー linux
rm -rf ${dir_name | file name}
-r
This is used to delete directories. Even if there is a directory in the directory, all deletion will be done.
-f
It is ok to delete the file on linux without confirmation. For example, when deleting a large number of files, it is commonly used option when it is troublesome to check each time. Also, no warning will be issued even if the file does not exist.
[vagrant@localhost tests]$ ls
dmm index.php test
[vagrant@localhost tests]$ rm -rf dmm
[vagrant@localhost tests]$ ls
index.php test
chown -R ${dir_name}
Check the permission with the “ll” command.
[vagrant@localhost tests]$ ll
合計 12
drwxr-xr-x 2 vagrant vagrant 4096 2月 17 14:36 2019 dmm
-rw-rw-r– 1 vagrant vagrant 551 2月 10 11:26 2019 index.php
drwxr-xr-x 4 vagrant vagrant 4096 2月 15 08:53 2019 test
[vagrant@localhost tests]$ cd dmm
[vagrant@localhost dmm]$ ll
合計 0
-rw-rw-r– 1 vagrant vagrant 0 2月 17 14:36 2019 dmm.txt
drwxr-xr-x is 755
-rw-rw-r– is 644
[vagrant@localhost tests]$ chmod -R 764 dmm
[vagrant@localhost tests]$ ll
合計 12
drwxrw-r– 2 vagrant vagrant 4096 2月 17 14:36 2019 dmm
-rw-rw-r– 1 vagrant vagrant 551 2月 10 11:26 2019 index.php
drwxr-xr-x 4 vagrant vagrant 4096 2月 15 08:53 2019 test
[vagrant@localhost tests]$ cd dmm
[vagrant@localhost dmm]$ ll
合計 0
-rwxrw-r– 1 vagrant vagrant 0 2月 17 14:36 2019 dmm.txt