Linux Installation
As a result of a slight focus on virtual machine-related knowledge, the knowledge about virtual machine software is generally known. Currently I know that the ubiquitous virtual machine software is VMware Workstation (hereinafter referred to as VM), VirtualBox (hereinafter referred to as VB). The rest may be a lot of people but I won't mention it if I don't use it.
I also made comparisons between VMs and VB. VB open source, free, and small size after installation, easy to use for beginners; VMs are powerful, can adjust the configuration of the virtual machine at any time, completely isolate and protect the host and virtual machine files, etc., but occupy a large space, and do not need free crack (although the crack is not difficult but in support of genuine copyright protection, and later encountered some problems or switch to the appropriate novice VB).
I downloaded two Ubuntu systems--17.04,16.04.3 LTS. Ubuntu releases a new system every six months and then abandons the maintenance of the system. The LTS version means long term support, a long supported version, with a five-year support period up to 2021. My virtual machine program also downloads the VMware Workstation 14pro and VirtualBox5.2.6 versions. At first I was using VMS and the ubuntu17.04 version, but after the installation I encountered a series of problems--first, the VM virtual machine is not known to Ubuntu or all systems, the display window is very small to download and install VMware tools to full screen. Then my 17.04 system for all the things that need to install the prompt cannot find the package, asked the seniors after I suggested that I change the source, but in the replacement of the source document code is very card, sometimes you can put the virtual machine card to the panic (My computer configured to i7-6700hq,16g ram,128g ssd+1t HDD,CPU and memory out of half to the virtual machine, hard disk 35G), then I choose to reinstall the system, after the success of VMware tools after installation can not take effect, change the source for Ali, the source of the university is useless, and online 17.04 version of the relevant support is also very little less than 16.04 more, and LTS is a long-term support version, so the second time replaced by VB and ubuntu16.04.3 LTS. This problem is solved naturally. The summary may be that you do not use the VM, and the online tutorial tutorial Compare the messy setup parameter problems, the installation of the system when the computer is still using other programs resulting in incomplete installation of the system caused.
In the use of virtual machine is also do not stress must be completely shut down after the virtual machine system to shut down the virtual machine software to shut down the host, or the virtual machine forced shutdown may cause the next time the Ubuntu system boot into the repair mode (GRUB), the first contact is not very understanding, the installation of online tutorials many times after the interface appears * Characters and garbled, forced to have installed a variety of content of the system reload. At present, the functions are normal.
Linux installation software is mostly in the terminal Input Command apt-get command to obtain, you need to pay attention to the correctness of the command. Can complete as much as possible with the complement.
When configuring virtual machine resource allocations, the memory should not exceed half of the host, and the remaining resources will not be allocated too high. Linux on the configuration requirements are not very high, excessive resources to cause the host to stutter, running on the host of virtual machine software is bound to Kaka.
Linux Learning Ingenious Linux Command Learning method summary
Operating system operating system for you to complete all "hardware-related, application-independent" work, to give you convenience, efficiency, security. Operating system features I conclude with two points: housekeeper and waiters:
管家婆:通过进程、虚拟内存和文件三个重要抽象管理计算机的CPU、内存、I/O设备。服务生:为用户提供shell,为程序员提供系统调用。
One of the features of the Linux learning app is that it can be used from the command line, and the benefits of the command line are mostly batch and automated, and some feature GUIs do not work.
Linux basic shortcut keys:
- Ctrl+alt+t: Open terminal;
- Ctrl+shift+t: New tab page
- ALT + number n: Switch to nth tab in terminal
- TAB: Command completion in terminal
- Up/down keyboard: Toggle command History
- CTRL + C: interrupts the program to run.
Linux system, we often use the man command to help see the specific use of this command, man is very powerful, but the English poor classmate with man may not be so handy, naturally appeared the Cheat command, The Cheat command is a simple example that tells you how to use a command.
and find the relevant core commands and Find,locate,grep,whereis,which, including:
Find where a file is located in the system, locate is a quick version of Find (Windows has an artifact everything and locate functions similar). You can learn the Find command by cheat find.
grep can be full-text retrieval of files, such as you take over a C language project, there are hundreds of C source files, you want to find the main function in that file, you can quickly find main in which C file by Grep-n main *.c and point out in the first few lines. GREP supports regular expressions, and regular expressions are also an important meta-knowledge. The grep command can be learned through cheat grep. Also mentioned above,
Whereis,which tells you where the command tool is installed. Linxu beginners will not be accustomed to the Linux file system, C drive it? Where's the D drive? Install the installation program with Apt-get It seems that we do not have to choose the installation location, where is the program installed? For example: We use the Firefox browser on the Internet under Linux, you can use Whereis Firefox or more accurate use of which firefox to see the results.
Apt-cache can install a program using the Apt-get installation, the first to find the software source of the library there is no this program, can be installed. For example, the teacher recommended a debugging tool DDD, you can use Apt-cache search ddd to check for this program.
Linux get started based on the experiment summarize the Linux common commands:
- Administrator rights: sudo su
- Recovery User: Su XXX
- Create a file File,touch files
- Enter a directory where the CD is a command
cd/etc/
- View your current directory
Pwd
- LS list file
- View user Input
Who am I
Or
Who mom likes
- Create user
sudo adduser XXX
- command to switch the logged on user:
Su-l XXX
- View user groups using the Groups command
Groups XXX or view/etc/group file
- To delete a user:
sudo deluser lilei--remove-home
- Change file owner: sudo chown Shiyanlou iphone6
- Modify Permissions:
Law One: chmod iphone6 (binary number representation)
Law II: chmod GO-RW iphone6 (plus and minus assignment operations)
- New Catalog: mkdir Mydir
- Copy file: CP Test (FileName) Father/son/grandson (folder name)
- Copy directory: Cp-r father Family (to successfully copy the directory needs to add the-R or-r parameter, which means recursive replication, that is, a bit "personalities" means:)
- Delete File: RM Test
- Forced Delete: rm-f test
- Delete directory: Rm-r family
- Moving files: MV file1 (folder 1) Documents (folder 2)
- Rename file: MV File1 (folder 1) myfile (folder 2)
- Batch rename: Use wildcards to create 5 of files in bulk:
$ Touch File{1..5}.txt
- Rename the 5 text files with a. c suffix to the file in bulk:
$ Rename ' s/.txt/.c/' *.txt
- Batch The 5 files, the file name to uppercase:
$ Rename ' y/a-z/a-z/' *.c
- View the contents of the PATH environment variable: $ echo $PATH
- Make the environment variable effective immediately: $ unset Temp
Zip compression Wrapper
To use the Zip Package folder:
$ zip-r-q-o Shiyanlou.zip/home/shiyanlou
$ du-h Shiyanlou.zip
$ file Shiyanlou.zip
Set the compression level to 9 and 1 (9 max, 1 min), RePack:
$ zip-r -9-q-o shiyanlou_9.zip/home/shiyanlou-x ~/. zip
$ zip-r -1-q-o shiyanlou_1.zip/home/shiyanlou-x ~/. zip
We will then use the DU command to view the default compression level, the lowest, the highest compression level, and the size of the uncompressed file:
$ du-h-D 0 *.zip ~ | Sort
View File Permissions
We have used the LS command many times before, as you can see, we use it to list and display the files in the current directory, of course, this is not with any parameters, it will certainly do more than that, and now we need to use it to view the file permissions.
To list files in a longer format:
You may not know the last item except the file name, so what does it mean?
Perhaps you still do not understand, such as the first file type and permissions that a bunch of things exactly what to refer to, what the link is, what is the last modification time, the following one by one ways:
Homework:
Experiment Four
Linux directory structure:
Directory path:
Go to the top level directory:
$ CD.
Go to your home directory:
$ cd ~
or cd/home/< your username >
Get the current path using PWD:
$ pwd
Relative path and absolute path:
Absolute path
$ cd/usr/local/bin
Relative path
$ CD. /.. /usr/local/bin
Basic operation of Linux files
New directory:
Create an empty directory named "Mydir":
$ mkdir Mydir
Using the-p parameter to create the parent directory at the same time (if the parent directory does not exist), we create a multilevel directory as follows:
$ mkdir-p Father/son/grandson
Copy
To successfully replicate the directory, you need to add the-R or-R parameters to indicate recursive replication:
$ cp-r Father Family
Delete
Use the RM (remove files or directories) command to delete a file:
$ RM Test
Force Delete
$ rm-f Test
To delete a directory:
As with the copy directory, to delete a directory, you also need to add the-R or-R parameters:
$ rm-r Family
Moving files
Use the MV (move or rename files) command to move the file (cut). Move the file "File1" to the Documents directory:
MV Source directory file destination directory:
$ mkdir Documents
$ mv File1 Documents
Renaming files
MV old filename New file name:
$ mv File1 myfile
Batch Rename
Use wildcards to create 5 of files in bulk:
$ Touch File{1..5}.txt
Rename the 5 text files with a. c suffix to the file in bulk:
$ Rename ' s/.txt/.c/' *.txt
Batch The 5 files, the file name to uppercase:
$ Rename ' y/a-z/a-z/' *.c
View Files
For example, we want to view the passwd files that were copied from the/etc directory:
$ cat passwd
You can add the line number with the-N parameter:
$ cat-n passwd
Homework:
Experimental five environment variables
Use the DECLARE command to create a variable named tmp:
$ DECLARE TMP
With the = Sign assignment operator, the variable TMP is assigned a value of Shiyanlou:
$ Tmp=shiyanlou
Read the value of the variable, using the Echo command and the $ symbol:
$ echo $tmp
Environment variables
Variable modification
Search for files
Search related commands are commonly used with whereis,which,find and locate.
$whereis who
, such as finding all files that start with SH under/etc:
$ locate/etc/sh
Find all JPG files under/usr/share/:
$ locate/usr/share/*.jpg
注意要添加 * 号前面的反斜杠转义,否则会无法找到。
If you want to only count the number can be added to the-c parameter, the-I parameter can be ignored case to find, Whereis-B,-M,-s can also be used.
Which itself is a shell built-in command, and we typically use which to determine if a specified software is installed because it only searches for the command from the path specified by the PATH environment variable:
$ which man
This command means to go to the/etc/directory and search for a file or directory named interfaces. This is the most common format for the Find command, so remember that the first parameter of find is the place to search:
$ sudo find/etc/-name interfaces
Homework:
Experiment Six
File package suffix Name Description:
Compressing packages with zip
Zip compression Wrapper
$ zip -r -q -o shiyanlou.zip /home/shiyanlou$ du -h shiyanlou.zip$ file shiyanlou.zip
Extracting a ZIP file using the unzip command
Unzip the shiyanlou.zip to the current directory:
$ unzip shiyanlou.zip
Use Quiet mode to extract the files to the specified directory:
$ unzip -q shiyanlou.zip -d ziptest
RAR Packaging Compression Command
Install RAR and Unrar tools:
$ sudo apt-get update$ sudo apt-get install rar unrar
To create a compressed package or add a file to a compressed package from a specified file or directory:
$ rm *.rar$ rar a shiyanlou.rar .
To delete a file from the specified compressed package file:
$ rar d shiyanlou.rar .zshrc
To view the unresolved files:
$ rar l shiyanlou.rar
Extracting RAR files using Unrar
Full path Decompression:
$ unrar x shiyanlou.rar
Remove Path Decompression:
$ mkdir tmp$ unrar e shiyanlou.rar tmp/
Tar packaging
Create a tar package:
$ tar -cf shiyanlou.tar ~
Unpack a file (-x parameter) to the existing directory of the specified path (-c parameter):
$ mkdir tardir$ tar -xf shiyanlou.tar -C tardir
To view only the unresolved package file-T parameter:
$ tar -tf shiyanlou.tar
Keep file attributes and follow links (symbolic links or soft links), sometimes we use tar to back up files when you restore to other hosts you want to keep the properties of the file (-p parameter) and the source file that the backup link points to instead of the link itself (-H parameter):
$ tar -cphf etc.tar /etc
We just need to add the-Z parameter to the build of the tar file and use gzip to compress the file:
$ tar -czf shiyanlou.tar.gz ~
Unzip the *.tar.gz file:
$ tar -xzf shiyanlou.tar.gz
Summarize:
Homework:
The current study of the more clear about here, the follow-up I will continue to learn to understand. This is the most effort of a blog, not only need to summarize learning knowledge, but also to embark on experimental practice. I believe that keeping this momentum can learn the course well.
20165231 Preview Job 3 Linux installation and learning