mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-15 01:50:08 +08:00
commit
e9de3535c3
@ -1,3 +1,5 @@
|
||||
#name1e5s translating
|
||||
|
||||
A Linux User Using ‘Windows 10′ After More than 8 Years – See Comparison
|
||||
================================================================================
|
||||
Windows 10 is the newest member of windows NT family of which general availability was made on July 29, 2015. It is the successor of Windows 8.1. Windows 10 is supported on Intel Architecture 32 bit, AMD64 and ARMv7 processors.
|
||||
|
@ -1,3 +1,5 @@
|
||||
HaohongWANG Translating
|
||||
|
||||
18 Years of GNOME Design and Software Evolution: Step by Step
|
||||
================================================================================
|
||||
注:youtube 视频
|
||||
@ -196,4 +198,4 @@ via: https://tlhp.cf/18-years-of-gnome-evolution/
|
||||
|
||||
[a]:https://tlhp.cf/author/paul/
|
||||
[1]:https://www.gnome.org/
|
||||
[2]:https://en.wikipedia.org/wiki/GNOME
|
||||
[2]:https://en.wikipedia.org/wiki/GNOME
|
||||
|
@ -1,53 +0,0 @@
|
||||
KDE vs GNOME vs XFCE Desktop
|
||||
================================================================================
|
||||

|
||||
|
||||
Over many years, many people spent a long time with Linux desktop using either KDE or GNOME. These two environments have grown through the previous years and each of these desktops continued to expand their current user-base. For example, sleeper desktop environment has been XFCE as XFCE offers more robustness than LXDE that lacks much of XFCE’s polish in the default configuration. The XFCE provides all benefits which users enjoyed in the GNOME 2, but with some lightweight experiences which made it a hit on the older computers.
|
||||
|
||||
### The Desktop Theming ###
|
||||
|
||||
After the user has fresh installation, the XFCE will be a bit boring, which lacks some certain visual attractiveness to it. So, don’t misunderstand my words here, the XFCE is still having nice looking desktop, but it may be like vanilla in users’ eyes as well as most people who are new to the XFCE desktop environment. The good news here is that while installing new theme to the XFCE, it is a reasonably easy process as you can easily find the right XFCE theme which appeals to you, after that, you can extract that theme to the proper directory. From this point, the XFCE comes with an important tool located under the Appearance for helping the user to select the chosen theme easily throughout the Graphical User Interface (GUID). There’re no other tools that might be required here, and if the user follows the above directions, it will be a bit simple for everyone who is caring to have a try.
|
||||
|
||||
On the GNOME desktop, the user should follow the similar above approach. The main key difference for this point is that users have to download and then install GNOME Tweak Tool before proceeding with anything. It does not have any huge barriers under any means, but it is simple valid oversight when the user consider that the XFCE does not require any tweak tool in order for installing and activating the new desktop themes. By being under the GNOME, and especially after installing that Tweak tool which is mentioned above, you will need to go ahead and also to make sure that you have the extension of User Themes installed.
|
||||
|
||||
The same as with the XFCE, the user will want to search for, and then download the theme which most appeals personally to him. Then, user can revisit to the GNOME Tweak tool, and click on the Appearance option on left side of that Tweak tool. Then, the user can simply look at the bottom of the page and click on file browse button to right of the Shell Theme. User then can browse to the zipped folder, and click open. In case if this process was successfully done, the user will see an alert that tell him that it was installed without any problems. From this point, user can simply use the pull down menu in order for selecting the theme he wants to use. The same as with the XFCE, process of theme activation is very easy, however, a need to download the non-included application for using a new theme will leave much to be desired.
|
||||
|
||||
Finally, there is the process of the KDE desktop theming. The same as with XFCE, there is no need at all to install any extra tools for making it work. This is one area where there is a feeling that the XFCE has to make the KDE the winner. Not only the installing themes in the KDE is accomplished entirely within the Graphical User Interface, but it’s also even possible to click on (Get New Themes) button and user will be able to locate, view, and also install the new themes automatically.
|
||||
|
||||
However, it should be noted that the KDE is a bit more robust desktop environment comparing to the XFCE. Therefore, it is a bit reasonable now to see why such extra functionalities could be missing from the desktops which are mainly designed to be minimalist. So, we all have to give the KDE props for such outstanding functionality.
|
||||
|
||||
### MATE is not Lightweight Desktop ###
|
||||
|
||||
Before continuing with the comparison between the XFCE, the GNOME 3 and the KDE, it should be clear for experts that we can’t touch the MATE desktop as an option in the comparison. MATE can be considered as the GNOME 2 desktop’s next incarnation, but it’s not mainly marketed to be a lightweight or fast desktop. But instead of that, its primary goal is to be more traditional and comfortable desktop environment where the users can feel right at their home to use it.
|
||||
|
||||
On the other hand, the XFCE comes with a completely other goal set. The XFCE offers its users a more lightweight and yet still visually appealing desktop experience. Then, for everyone who points out that MATE is a lightweight desktop too, it isn’t really targeting that lightweight desktop crowd. Both options may be dressed up for looking quite attractive with the proper theme installed.
|
||||
|
||||
### The Navigation of Desktop ###
|
||||
|
||||
The XFCE honestly offers an obvious navigation which is out of the box. Anyone who is used to the traditional Windows or the GNOME 2/MATE desktop experience will be going to have the ability to navigate around the new XFCE installation without any kind of help. Straight away, adding the applets to panel is still very obvious. The same as with locating installed applications, just use the launcher and simply click on any desired application. With an exception of LXDE and MATE, there is no other desktop that can make the navigation that simple. What can be even better is that fact which the control panel is very easy to use, that is a really big benefit to everyone who is new to the desktop environment. If the user prefer older methods to use his desktop, then GNOME is not an option. With the hot corners as well as the no minimize button, plus the other application layout method, it’ll take the most newcomers getting easily used to it.
|
||||
|
||||
If the user is coming from, as an example, Windows environment, then he is going to be put off by the inability to add applets to the top of his workspace simply with just a mere right-click. Just instead of this, it can be handled by using extensions. Installing extensions in the GNOME is granted and is a brain-dead easy, based on the easy to use (on/off) toggle switches located on the extensions page of the GNOME. Users have to know, sadly, to actually visit that page to enjoy this functionality.
|
||||
|
||||
On the other side, the GNOME is sharing its desire for providing a straight forward and an easy to use control panel, which many of you may think that it is not be a big deal, but it is really something that I by myself find commendable and worth to be mentioned. The KDE offers its users a bit more traditional desktop experience, throughout familiar launchers as well as the ability for getting to the software in more familiar way if they are coming from Windows desktop. The process of adding widgets or applets to the KDE desktop is an easy matter of just right-clicking on the bottom of the desktop. Only the problem with the KDE’s approach is to be that, as many things KDE, the feature which users are actually looking for are hidden. The KDE users might berate my opinion for this, but I still stand by my statement.
|
||||
|
||||
In order for adding a Widget, just right-click on “my panel”, just to see the panel options, but not as an immediate method to install Widgets. You will not actually see the Add Widgets until you select the Panel Options, then the Add Widgets. This not a big deal to me, but later for some users, it becomes unnecessary tidbit of confusion. To make things here more convoluted, after the users manage to locate Widgets area they discover later a brand new term called “Activities”. It is in the same area as the Widgets, yet it is somehow in its own area as to what it does.
|
||||
|
||||
Now don’t misunderstand me, the Activities feature in the KDE is totally great and actually valued. But to look at it from the usability standpoint, I think that it would be better suited in another menu option in order to not confuse the newbies. User is welcome to differ, but to test this with newbies for some extended periods of time can prove the correct over and over again. The rant against the Activities placement aside, the KDE approach to add new widgets is really great. The same as with the KDE themes, user can’t browse through and install the Widgets automatically via using the provided Graphical User Interface. It is a bit fantastic of functionality, and also it could be celebrated such way. The control panel of the KDE is not as easy as the user might like it to be, yet it is a bit clear that this’s something that they are still working on.
|
||||
|
||||
### So, the XFCE is the best desktop, right? ###
|
||||
|
||||
I, by myself, actually run GNOME, KDE, and XFCE on my computers in my office and home. I also have some older machines with OpenBox and LXDE too. Each desktop experience can offer something that is a bit useful to me and may help me to use each machine as I see that it is fit. For me, I have a soft spot in my heart for the XFCE as it is one of the desktop environments which I stuck with for years. But in this article, I’m just writing it on my daily use computer which is in fact, GNOME.
|
||||
|
||||
The main idea here is that I still feel that the XFCE provides a bit better user experience for users who are looking for stable, traditional, and easy to understand desktop environment. You are also welcome to share with us your opinion in the comments section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/kde-vs-gnome-vs-xfce-desktop/
|
||||
|
||||
作者:[M.el Khamlichi][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/pirat9/
|
@ -1,3 +1,5 @@
|
||||
Translating by icecoobe.
|
||||
|
||||
What’s the Best File System for My Linux Install?
|
||||
================================================================================
|
||||

|
||||
|
@ -1,61 +0,0 @@
|
||||
translating By Bestony
|
||||
Remember sed and awk? All Linux admins should
|
||||
================================================================================
|
||||

|
||||
|
||||
Credit: Shutterstock
|
||||
|
||||
**We aren’t doing the next generation of Linux and Unix admins any favors by forgetting init scripts and fundamental tools**
|
||||
|
||||
I happened across a post on Reddit by chance, [asking about textfile manipulation][1]. It was a fairly simple request, similar to those that folks in Unix see nearly every day. In this case, it was how to remove all duplicate lines in a file, keeping one instance of each. This sounds relatively easy, but can get a bit complicated if the source file is sufficiently large and random.
|
||||
|
||||
There are countless answers to this problem. You could write a script in nearly any language to do this, with varying levels of complexity and time investment, which I suspect is what most would do. It might take 20 or 60 minutes depending on skill level, but armed with Perl, Python, or Ruby, you could make quick work of it.
|
||||
|
||||
Or you could use the answer stated in that thread, which warmed my heart: Just use awk.
|
||||
|
||||
That answer is the most concise and simplest solution to the problem by far. It’s one line:
|
||||
|
||||
awk '!seen[$0]++' <filename>.
|
||||
|
||||
Let’s take a look at this.
|
||||
|
||||
In this command, there’s a lot of hidden code. Awk is a text processing language, and as such it makes a lot of assumptions. For starters, what you see here is actually the meat of a for loop. Awk assumes you want to loop through every line of the input file, so you don’t need to explicitly state it. Awk also assumes you want to print the postprocessed output, so you don’t need to state that either. Finally, Awk then assumes the loop ends when the last statement finishes, so no need to state it.
|
||||
|
||||
The string seen in this example is the name given to an associative array. $0 is a variable that represents the entirety of the current line of the file. Thus, this command translates to “Evaluate every line in this file, and if you haven’t seen this line before, print it.” Awk does this by adding $0 to the seen array if it doesn’t already exist and incrementing the value so that it will not match the pattern the next time around and, thus, not print.
|
||||
|
||||
Some will see this as elegant, while others may see this as obfuscation. Anyone who uses awk on a daily basis will be in the first group. Awk is designed to do this. You can write multiline programs in awk. You can even write [disturbingly complex functions in awk][2]. But at the end of the day, awk is designed to do text processing, generally within a pipe. Eliminating the extraneous cruft of loop definition is simply a shortcut for a very common use case. If you like, you could write the same thing as the following:
|
||||
|
||||
awk '{ if (!seen[$0]) print $0; seen[$0]++ }’
|
||||
|
||||
It would lead to the same result.
|
||||
|
||||
Awk is the perfect tool for this job. Nevertheless, I believe many admins -- especially newer admins -- would jump into [Bash][3] or Python to try to accomplish this task, because knowledge of awk and what it can do seems to be fading as time goes on. I think it may be an indicator of things to come, where problems that have been solved for decades suddenly emerge again, based on lack of exposure to the previous solutions.
|
||||
|
||||
The shell, grep, sed, and awk are fundaments of Unix computing. If you’re not completely comfortable with their use, you’re artificially hamstrung because they form the basis of interaction with Unix systems via the CLI and shell scripting. One of the best ways to learn how these tools work is by observing and working with live examples, which every Unix flavor has in spades with their init systems -- or had, in the case of Linux distros that have adopted [systemd][4].
|
||||
|
||||
Millions of Unix admins learned how shell scripting and Unix tools worked by reading, writing, modifying, and working with init scripts. Init scripts differ greatly from OS to OS, even from distribution to distribution in the case of Linux, but they are all rooted in sh, and they all use core CLI tools like sed, awk, and grep.
|
||||
|
||||
I’ve heard many complaints that init scripts are “ancient” and “difficult,” but in fact, init scripts use the same tools that Unix admins work with every day, and thus provide an excellent way to become more familiar and comfortable with those tools. Saying that init scripts are hard to read or difficult to work with is to admit that you lack fundamental familiarity with the Unix toolset.
|
||||
|
||||
Speaking of things found on Reddit, I also came across this question from a budding Linux sys admin, [asking whether he should bother to learn sysvinit][5]. Most of the answers in the thread are good -- yes, definitely learn sysvinit and systemd. One commenter even notes that init scripts are a great way to learn Bash, and another states that the Fortune 50 company he works for has no plans to move to a systemd-based release.
|
||||
|
||||
But it concerns me that this is a question at all. If we continue down the path of eliminating scripts and roping off core system elements within our operating systems, we will inadvertently make it harder for new admins to learn the fundamental Unix toolset due to the lack of exposure.
|
||||
|
||||
I’m not sure why some want to cover up Unix internals with abstraction after abstraction, but such a path may reduce a generation of Unix admins to hapless button pushers dependent on support contracts. I’m pretty sure that would not be a good development.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.infoworld.com/article/2985804/linux/remember-sed-awk-linux-admins-should.html
|
||||
|
||||
作者:[Paul Venezia][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.infoworld.com/author/Paul-Venezia/
|
||||
[1]:https://www.reddit.com/r/linuxadmin/comments/3lwyko/how_do_i_remove_every_occurence_of_duplicate_line/
|
||||
[2]:http://intro-to-awk.blogspot.com/2008/08/awk-more-complex-examples.html
|
||||
[3]:http://www.infoworld.com/article/2613338/linux/linux-how-to-script-a-bash-crash-course.html
|
||||
[4]:http://www.infoworld.com/article/2608798/data-center/systemd--harbinger-of-the-linux-apocalypse.html
|
||||
[5]:https://www.reddit.com/r/linuxadmin/comments/3ltq2y/when_i_start_learning_about_linux_administration/
|
@ -1,3 +1,5 @@
|
||||
alim0x translating
|
||||
|
||||
15 Useful Linux and Unix Tape Managements Commands For Sysadmins
|
||||
================================================================================
|
||||
Tape devices should be used on a regular basis only for archiving files or for transferring data from one server to another. Usually, tape devices are all hooked up to Unix boxes, and controlled with mt or mtx. You must backup all data to both disks (may be in cloud) and tape device. In this tutorial you will learn about:
|
||||
@ -62,24 +64,24 @@ Type the following commands:
|
||||
## Linux (read man pages for more info) ##
|
||||
lsscsi
|
||||
lsscsi -g
|
||||
|
||||
|
||||
## IBM AIX ##
|
||||
lsdev -Cc tape
|
||||
lsdev -Cc adsm
|
||||
lscfg -vl rmt*
|
||||
|
||||
|
||||
## Solaris Unix ##
|
||||
cfgadm –a
|
||||
cfgadm -al
|
||||
luxadm probe
|
||||
iostat -En
|
||||
|
||||
|
||||
## HP-UX Unix ##
|
||||
ioscan Cf
|
||||
ioscan -funC tape
|
||||
ioscan -fnC tape
|
||||
ioscan -kfC tape
|
||||
|
||||
|
||||
|
||||
Sample outputs from my Linux server:
|
||||
|
||||
@ -105,26 +107,26 @@ You can set TAPE shell variable. This is the pathname of the tape drive. The def
|
||||
|
||||
### 1: Display status of the tape/drive ###
|
||||
|
||||
mt status #Use default
|
||||
mt status #Use default
|
||||
mt -f /dev/rmt/0 status #Unix
|
||||
mt -f /dev/st0 status #Linux
|
||||
mt -f /dev/st0 status #Linux
|
||||
mt -f /dev/nsa0 status #FreeBSD
|
||||
mt -f /dev/rmt/1 status #Unix unity 1 i.e. tape device no. 1
|
||||
|
||||
mt -f /dev/rmt/1 status #Unix unity 1 i.e. tape device no. 1
|
||||
|
||||
You can use shell loop as follows to poll a system and locate all of its tape drives:
|
||||
|
||||
for d in 0 1 2 3 4 5
|
||||
do
|
||||
mt -f "/dev/rmt/${d}" status
|
||||
done
|
||||
|
||||
|
||||
### 2: Rewinds the tape ###
|
||||
|
||||
mt rew
|
||||
mt rewind
|
||||
mt -f /dev/mt/0 rewind
|
||||
mt -f /dev/st0 rewind
|
||||
|
||||
|
||||
### 3: Eject the tape ###
|
||||
|
||||
mt off
|
||||
@ -132,27 +134,27 @@ You can use shell loop as follows to poll a system and locate all of its tape dr
|
||||
mt eject
|
||||
mt -f /dev/mt/0 off
|
||||
mt -f /dev/st0 eject
|
||||
|
||||
|
||||
### 4: Erase the tape (rewind the tape and, if applicable, unload the tape) ###
|
||||
|
||||
mt erase
|
||||
mt -f /dev/st0 erase #Linux
|
||||
mt -f /dev/rmt/0 erase #Unix
|
||||
|
||||
mt -f /dev/st0 erase #Linux
|
||||
mt -f /dev/rmt/0 erase #Unix
|
||||
|
||||
### 5: Retensioning a magnetic tape cartridge ###
|
||||
|
||||
If errors occur when a tape is being read, you can retension the tape, clean the tape drive, and then try again as follows:
|
||||
|
||||
mt retension
|
||||
mt -f /dev/rmt/1 retension #Unix
|
||||
mt -f /dev/st0 retension #Linux
|
||||
|
||||
mt -f /dev/st0 retension #Linux
|
||||
|
||||
### 6: Writes n EOF marks in the current position of tape ###
|
||||
|
||||
mt eof
|
||||
mt weof
|
||||
mt -f /dev/st0 eof
|
||||
|
||||
|
||||
### 7: Forward space count files i.e. jumps n EOF marks ###
|
||||
|
||||
The tape is positioned on the first block of the next file i.e. tape will position on first block of the field (see fig.01):
|
||||
@ -160,7 +162,7 @@ The tape is positioned on the first block of the next file i.e. tape will positi
|
||||
mt fsf
|
||||
mt -f /dev/rmt/0 fsf
|
||||
mt -f /dev/rmt/1 fsf 1 #go 1 forward file/tape (see fig.01)
|
||||
|
||||
|
||||
### 8: Backward space count files i.e. rewinds n EOF marks ###
|
||||
|
||||
The tape is positioned on the first block of the next file i.e. tape positions after EOF mark (see fig.01):
|
||||
@ -168,27 +170,27 @@ The tape is positioned on the first block of the next file i.e. tape positions a
|
||||
mt bsf
|
||||
mt -f /dev/rmt/1 bsf
|
||||
mt -f /dev/rmt/1 bsf 1 #go 1 backward file/tape (see fig.01)
|
||||
|
||||
|
||||
Here is a list of the tape position commands:
|
||||
|
||||
fsf Forward space count files. The tape is positioned on the first block of the next file.
|
||||
|
||||
|
||||
fsfm Forward space count files. The tape is positioned on the last block of the previous file.
|
||||
|
||||
|
||||
bsf Backward space count files. The tape is positioned on the last block of the previous file.
|
||||
|
||||
|
||||
bsfm Backward space count files. The tape is positioned on the first block of the next file.
|
||||
|
||||
|
||||
asf The tape is positioned at the beginning of the count file. Positioning is done by first rewinding the tape and then spacing forward over count filemarks.
|
||||
|
||||
|
||||
fsr Forward space count records.
|
||||
|
||||
|
||||
bsr Backward space count records.
|
||||
|
||||
|
||||
fss (SCSI tapes) Forward space count setmarks.
|
||||
|
||||
|
||||
bss (SCSI tapes) Backward space count setmarks.
|
||||
|
||||
|
||||
### Basic backup commands ###
|
||||
|
||||
Let us see commands to backup and restore files
|
||||
@ -197,31 +199,31 @@ Let us see commands to backup and restore files
|
||||
|
||||
tar cvf /dev/rmt/0n /etc
|
||||
tar cvf /dev/st0 /etc
|
||||
|
||||
|
||||
### 10: To restore directory (tar format) ###
|
||||
|
||||
tar xvf /dev/rmt/0n -C /path/to/restore
|
||||
tar xvf /dev/st0 -C /tmp
|
||||
|
||||
|
||||
### 11: List or check tape contents (tar format) ###
|
||||
|
||||
mt -f /dev/st0 rewind; dd if=/dev/st0 of=-
|
||||
|
||||
|
||||
## tar format ##
|
||||
tar tvf {DEVICE} {Directory-FileName}
|
||||
tar tvf /dev/st0
|
||||
tar tvf /dev/st0 desktop
|
||||
tar tvf /dev/rmt/0 foo > list.txt
|
||||
|
||||
|
||||
### 12: Backup partition with dump or ufsdump ###
|
||||
|
||||
## Unix backup c0t0d0s2 partition ##
|
||||
ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s2
|
||||
|
||||
|
||||
## Linux backup /home partition ##
|
||||
dump 0uf /dev/nst0 /dev/sda5
|
||||
dump 0uf /dev/nst0 /home
|
||||
|
||||
|
||||
## FreeBSD backup /usr partition ##
|
||||
dump -0aL -b64 -f /dev/nsa0 /usr
|
||||
|
||||
@ -231,12 +233,12 @@ Let us see commands to backup and restore files
|
||||
ufsrestore xf /dev/rmt/0
|
||||
## Unix interactive restore ##
|
||||
ufsrestore if /dev/rmt/0
|
||||
|
||||
|
||||
## Linux ##
|
||||
restore rf /dev/nst0
|
||||
## Restore interactive from the 6th backup on the tape media ##
|
||||
restore isf 6 /dev/nst0
|
||||
|
||||
|
||||
## FreeBSD restore ufsdump format ##
|
||||
restore -i -f /dev/nsa0
|
||||
|
||||
@ -244,10 +246,10 @@ Let us see commands to backup and restore files
|
||||
|
||||
## This will overwrite all data on tape ##
|
||||
mt -f /dev/st1 rewind
|
||||
|
||||
|
||||
### Backup home ##
|
||||
tar cvf /dev/st1 /home
|
||||
|
||||
|
||||
## Offline and unload tape ##
|
||||
mt -f /dev/st0 offline
|
||||
|
||||
@ -256,28 +258,28 @@ To restore from the beginning of the tape:
|
||||
mt -f /dev/st0 rewind
|
||||
tar xvf /dev/st0
|
||||
mt -f /dev/st0 offline
|
||||
|
||||
|
||||
### 14: Start writing after the last tar (see fig.02) ###
|
||||
|
||||
## This will kee all data written so far ##
|
||||
mt -f /dev/st1 eom
|
||||
|
||||
|
||||
### Backup home ##
|
||||
tar cvf /dev/st1 /home
|
||||
|
||||
|
||||
## Unload ##
|
||||
mt -f /dev/st0 offline
|
||||
|
||||
|
||||
### 15: Start writing after tar number 2 (see fig.02) ###
|
||||
|
||||
## To wrtite after tar number 2 (should be 2+1)
|
||||
mt -f /dev/st0 asf 3
|
||||
tar cvf /dev/st0 /usr
|
||||
|
||||
|
||||
## asf equivalent command done using fsf ##
|
||||
mt -f /dev/sf0 rewind
|
||||
mt -f /dev/st0 fsf 2
|
||||
|
||||
|
||||
To restore tar from tar number 2:
|
||||
|
||||
mt -f /dev/st0 asf 3
|
||||
@ -308,28 +310,28 @@ It is important that you do regular full system restorations and service testing
|
||||
# Last updated on : Feb-2007 - Added support for excluding files / dirs.
|
||||
# -------------------------------------------------------------------------
|
||||
LOGBASE=/root/backup/log
|
||||
|
||||
|
||||
# Backup dirs; do not prefix /
|
||||
BACKUP_ROOT_DIR="home sales"
|
||||
|
||||
|
||||
# Get todays day like Mon, Tue and so on
|
||||
NOW=$(date +"%a")
|
||||
|
||||
|
||||
# Tape devie name
|
||||
TAPE="/dev/st0"
|
||||
|
||||
|
||||
# Exclude file
|
||||
TAR_ARGS=""
|
||||
EXCLUDE_CONF=/root/.backup.exclude.conf
|
||||
|
||||
|
||||
# Backup Log file
|
||||
LOGFIILE=$LOGBASE/$NOW.backup.log
|
||||
|
||||
|
||||
# Path to binaries
|
||||
TAR=/bin/tar
|
||||
MT=/bin/mt
|
||||
MKDIR=/bin/mkdir
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Excluding files when using tar
|
||||
# Create a file called $EXCLUDE_CONF using a text editor
|
||||
@ -338,7 +340,7 @@ It is important that you do regular full system restorations and service testing
|
||||
# home/vivek/*.cpp~
|
||||
# ------------------------------------------------------------------------
|
||||
[ -f $EXCLUDE_CONF ] && TAR_ARGS="-X $EXCLUDE_CONF"
|
||||
|
||||
|
||||
#### Custom functions #####
|
||||
# Make a full backup
|
||||
full_backup(){
|
||||
@ -349,7 +351,7 @@ It is important that you do regular full system restorations and service testing
|
||||
$MT -f $TAPE offline
|
||||
cd $old
|
||||
}
|
||||
|
||||
|
||||
# Make a partial backup
|
||||
partial_backup(){
|
||||
local old=$(pwd)
|
||||
@ -359,7 +361,7 @@ It is important that you do regular full system restorations and service testing
|
||||
$MT -f $TAPE offline
|
||||
cd $old
|
||||
}
|
||||
|
||||
|
||||
# Make sure all dirs exits
|
||||
verify_backup_dirs(){
|
||||
local s=0
|
||||
@ -374,15 +376,15 @@ It is important that you do regular full system restorations and service testing
|
||||
# if not; just die
|
||||
[ $s -eq 1 ] && exit 1
|
||||
}
|
||||
|
||||
|
||||
#### Main logic ####
|
||||
|
||||
|
||||
# Make sure log dir exits
|
||||
[ ! -d $LOGBASE ] && $MKDIR -p $LOGBASE
|
||||
|
||||
|
||||
# Verify dirs
|
||||
verify_backup_dirs
|
||||
|
||||
|
||||
# Okay let us start backup procedure
|
||||
# If it is Monday make a full backup;
|
||||
# For Tue to Fri make a partial backup
|
||||
@ -392,7 +394,7 @@ It is important that you do regular full system restorations and service testing
|
||||
Tue|Wed|Thu|Fri) partial_backup;;
|
||||
*) ;;
|
||||
esac > $LOGFIILE 2>&1
|
||||
|
||||
|
||||
### A note about third party backup utilities ###
|
||||
|
||||
Both Linux and Unix-like system provides many third-party utilities which you can use to schedule the creation of backups including tape backups such as:
|
||||
@ -422,4 +424,4 @@ via: http://www.cyberciti.biz/hardware/unix-linux-basic-tape-management-commands
|
||||
[3]:http://www.manpager.com/linux/man1/mtx.1.html
|
||||
[4]:http://www.manpager.com/linux/man1/tar.1.html
|
||||
[5]:http://www.manpager.com/linux/man8/dump.8.html
|
||||
[6]:http://www.manpager.com/linux/man8/restore.8.html
|
||||
[6]:http://www.manpager.com/linux/man8/restore.8.html
|
||||
|
@ -1,4 +1,3 @@
|
||||
translate by zky001
|
||||
* * *
|
||||
|
||||
# GCC-Inline-Assembly-HOWTO
|
||||
@ -626,6 +625,6 @@ If you have found any glaring typos, or outdated info in this document, please l
|
||||
* * *
|
||||
via: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
|
||||
|
||||
作者:[Sandeep.S](mailto:busybox@sancharnet.in) 译者:[zky001](https://github.com/zky001) 校对:[]()
|
||||
作者:[Sandeep.S](mailto:busybox@sancharnet.in) 译者:[](https://github.com/) 校对:[]()
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
@ -1,236 +0,0 @@
|
||||
翻译中。。。。。
|
||||
Grub 2: Heal your bootloader
|
||||
================================================================================
|
||||
**There are few things as irritating as a broken bootloader. Get the best out of Grub 2 and keep it shipshape.**
|
||||
|
||||
Why do this?
|
||||
|
||||
- Grub 2 is the most popular bootloader that’s used by almost every Linux distribution.
|
||||
- A bootloader is a vital piece of software, but they are susceptible to damage.
|
||||
- Grub 2 is an expansive and flexible boot loader that offers various customisable options.
|
||||
|
||||
The Grub 2 Linux bootloader is a wonderful and versatile piece of software. While it isn’t the only bootloader out there, it’s the most popular and almost all the leading desktop distros use it. The job of the Grub bootloader is twofold. First, it displays a menu of all installed operating systems on a computer and invites you to pick one. Second, Grub loads the Linux kernel if you choose a Linux operating system from the boot menu.
|
||||
|
||||
As you can see, if you use Linux, you can’t escape the bootloader. Yet it’s one the least understood components inside a Linux distro. In this tutorial we’ll familiarise you with some of Grub 2’s famed versatility and equip you with the skills to help yourself when you have a misbehaving bootloader.
|
||||
|
||||
The most important parts of Grub 2 are a bunch of text files and a couple of scripts. The first piece to know is **/etc/default/grub**. This is the text file in which you can set the general configuration variables and other characteristics of the Grub 2 menu (see box titled “Common user settings”).
|
||||
|
||||
The other important aspect of Grub 2 is the **/etc/grub.d** folder. All the scripts that define each menu entry are housed there. The names of these scripts must have a two-digit numeric prefix. Its purpose is to define the order in which the scripts are executed and the order of the corresponding entries when the Grub 2 menu is built. The **00_header** file is read first, which parses the **/etc/default/grub** configuration file. Then come the entries for the Linux kernels in the **10_linux** file. This script creates one regular and one recovery menu entry for each kernel in the default **/boot** partition.
|
||||
|
||||
This script is followed by others for third-party apps such as **30_os-prober** and **40_custom**. The **os-prober** script creates entries for kernels and other operating systems found on other partitions. It can recognise Linux, Windows, BSD and Mac OS X installations. If your hard disk layout is too exotic for the **os-prober** script to pick up an installed distro, you can add it to the **40_custom** file (see the “Add custom entries” box).
|
||||
|
||||
**Grub** 2 does not require you to manually maintain your boot options’ configuration file: instead it generates the **/boot/grub/grub.cfg** file with the **grub2-mkconfig** command. This utility will parse the scripts in the **/etc/grub.d** directory and the **/etc/default/grub** settings file to define your setup.
|
||||
|
||||
Graphical boot repair
|
||||
|
||||
A vast majority of Grub 2 issues can easily be resolved with the touch of a button thanks to the Boot Repair app. This nifty little application has an intuitive user interface and can scan and comprehend various kinds of disk layouts and partitioning schemes, and can sniff out and correctly identify operating system installations inside them. The utility works on traditional computers with a Master Boot Record (MBR) as well as the newer UEFI computers with the UID Partition Table (GPT) layout.
|
||||
|
||||
The easiest way to use Boot Repair is to install it inside a Live Ubuntu session. Fire up an Ubuntu Live distro on a machine with a broken bootloader and install Boot Repair by first adding its PPA repository with
|
||||
|
||||
sudo add-apt-repository ppa:yannubuntu/Boot Repair
|
||||
|
||||
Then refresh the list of repositories with
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
before installing the app with
|
||||
|
||||
sudo apt-get install -y Boot Repair
|
||||
|
||||
Fire up the tool once it’s installed. The app will scan your hard disk before displaying its interface, which is made up of a couple of buttons. To follow the advice of the tool, simply press the Recommended Repair button, which should fix most broken bootloaders. After it’s restored your bootloader, the tool also spits out a small URL which you should note. The URL contains a detailed summary of your disks, including your partitions along with the contents of important Grub 2 files including **/etc/default/grub** and **boot/grub/grub.cfg**. If the tool hasn’t been able to fix your bootloader, you can share the URL on your distro’s forum boards to allow others to understand your disk layout and offer suggestions.
|
||||
|
||||

|
||||
|
||||
**Boot Repair also lets you customise Grub 2’s options.**
|
||||
|
||||
#### Bootloader bailout ####
|
||||
|
||||
Grub 2 boot problems can leave the system in several states. The text on the display where you’d expect the bootloader menu gives an indication of the current state of the system. If the system stops booting at the **grub>** prompt, it means the Grub 2 modules were loaded but it couldn’t find the **grub.cfg** file. This is the full Grub 2 command shell and you can do quite a bit here to help yourself. If you see the **grub rescue>** prompt, it means that the bootloader couldn’t find the Grub 2 modules nor could it find any of your boot files. However, if your screen just displays the word ‘GRUB’, it means the bootloader has failed to find even the most basic information that’s usually contained in the Master Boot Record.
|
||||
|
||||
You can correct these Grub failures either by using a live CD or from Grub 2’s command shell. If you’re lucky and your bootloader drops you at the **grub>** prompt, you have the power of the Grub 2 shell at your disposal to correct any errors.
|
||||
|
||||
The next few commands work with both **grub>** and **grub rescue>**. The **set pager=1** command invokes the pager, which prevents text from scrolling off the screen. You can also use the **ls** command which lists all partitions that Grub sees, like this:
|
||||
|
||||
grub> ls
|
||||
(hd0) (hd0,msdos5) (hd0,msdos6) (hd1,msdos1)
|
||||
|
||||
As you can see, the command also lists the partition table scheme along with the partitions.
|
||||
|
||||
You can also use the **ls** command on each partition to find your root filesystem:
|
||||
|
||||
grub> ls (hd0,5)/
|
||||
lost+found/ var/ etc/ media/ bin/ initrd.gz
|
||||
boot/ dev/ home/ selinux/ srv/ tmp/ vmlinuz
|
||||
|
||||
You can drop the **msdos** bit from the name of the partition. Also, if you miss the trailing slash and instead say **ls (hd0,5)** you’ll get information about the partition including its filesystem type, total size, and last modification time. If you have multiple partitions, read the contents of the **/etc/issue** file with the **cat** command to identify the distro, such as **cat (hd0,5)/etc/issue**.
|
||||
|
||||
Assuming you find the root filesystem you’re looking for inside **(hd0,5)**, make sure that it contains the /**boot/grub** directory and the Linux kernel image you wish to boot into, such as **vmlinuz-3.13.0-24-generic**. Now type the following:
|
||||
|
||||
grub> set root=(hd0,5)
|
||||
grub> linux /boot/vmlinuz-3.13.0-24-generic root=/dev/sda5
|
||||
grub> initrd /boot/initrd.img-3.13.0-24-generic
|
||||
|
||||
The first command points Grub to the partition housing the distro we wish to boot into. The second command then tells Grub the location of the kernel image inside the partition as well as the location of the root filesystem. The final line sets the location of the initial ramdisk file. You can use tab autocompletion to fill in the name of the kernel and the initrd, which will save you a lot of time and effort.
|
||||
|
||||
Once you’ve keyed these in, type **boot** at the next **grub>** prompt and Grub will boot into the specified operating system.
|
||||
|
||||
Things are a little different if you’re at the **grub rescue>** prompt. Since the bootloader hasn’t been able to find and load any of the required modules, you’ll have to insert them manually:
|
||||
|
||||
grub rescue> set root=(hd0,5)
|
||||
grub rescue> insmod (hd0,5)/boot/grub/normal.mod
|
||||
grub rescue> normal
|
||||
grub> insmod linux
|
||||
|
||||
As you can see, just like before, after we use the **ls** command to hunt down the Linux partition, we mark it with the **set** command. We then insert the **normal** module, which when activated will return us to the standard **grub>** mode. The next command then inserts the linux module in case it hasn’t been loaded. Once this module has been loaded you can proceed to point the boot loader to the kernel image and initrd files just as before and round off the procedure with the **boot** command to bring up the distro.
|
||||
|
||||
Once you’ve successfully booted into the distro, don’t forget to regenerate a new configuration file for Grub with the
|
||||
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
command. You’ll also have to install a copy of the bootloader into the MBR with the
|
||||
|
||||
sudo grub2-install /dev/sda
|
||||
|
||||
command.
|
||||
|
||||

|
||||
|
||||
**To disable a script under the /etc/grub.d, all you need to do is remove the executable bit, for example with chmod -x /etc/grub.d/20_memtest86+ which will remove the ‘Memory Test’ option from the menu.**
|
||||
|
||||
### Grub 2 and UEFI ###
|
||||
|
||||
UEFI-enabled machines (more or less, any machine sold in the last couple of years) have added another layer of complexity to debugging a broken **Grub 2** bootloader. While the procedure for restoring a **Grub 2** install on a UEFI machine isn’t much different than it is on a non-UEFI machine, the newer firmware handles things differently, which results in mixed restoration results.
|
||||
|
||||
On a UEFI-based system, you do not install anything in the MBR. Instead you install a Linux EFI bootloader in the EFI System Partition (ESP) and set it as the EFI’s default boot program using a tool such as **efibootmgr** for Linux, or **bcdedit** for Windows.
|
||||
|
||||
As things stand now, the Grub 2 bootloader should be installed properly when installing any major desktop Linux distro, which will happily coexist with Windows 8. However, if you end up with a broken bootloader, you can restore the machine with a live distro. When you boot the live medium, make sure you boot it in the UEFI mode. The computer’s boot menu will have two boot options for each removable drive – a vanilla option and an option tagged with UEFI. Use the latter to expose the EFI variables in **/sys/firmware/efi/**.
|
||||
|
||||
From the live environment, mount the root filesystem of the broken installation as mentioned in the tutorial. You’ll also have to mount the ESP partition. Assuming it’s **/dev/sda1**, you can mount it with
|
||||
|
||||
sudo mount /dev/sda1 /mnt/boot/efi
|
||||
|
||||
Then load the **efivars** module with **modprobe efivars** before chrooting into the installed distribution as shown in the tutorial.
|
||||
|
||||
Here on, if you’re using Fedora, reinstall the bootloader with the
|
||||
|
||||
yum reinstall grub2-efi shim
|
||||
|
||||
command followed by
|
||||
|
||||
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
to generate the new configuration file. Ubuntu users can do this with
|
||||
|
||||
apt-get install --reinstall grub-efi-amd64
|
||||
|
||||
With the bootloader in place, exit chroot, unmount all partitions and reboot to the Grub 2 menu.
|
||||
|
||||
#### Dude, where’s my Grub? ####
|
||||
|
||||
The best thing about Grub 2 is that you can reinstall it whenever you want. So if you lose the Grub 2 bootloader, say when another OS like Windows replaces it with its own bootloader, you can restore Grub within a few steps with the help of a live distro. Assuming you’ve installed a distro on **/dev/sda5**, you can reinstall Grub by first creating a mount directory for the distro with
|
||||
|
||||
sudo mkdir -p /mnt/distro
|
||||
|
||||
and then mounting the partition with
|
||||
|
||||
mount /dev/sda5 /mnt/distro
|
||||
|
||||
You can then reinstall Grub with
|
||||
|
||||
grub2-install --root-directory=/mnt/distro /dev/sda
|
||||
|
||||
This command will rewrite the MBR information on the **/dev/sda** device, point to the current Linux installation and rewrite some Grub 2 files such as **grubenv** and **device.map**.
|
||||
|
||||
Another common issue pops up on computers with multiple distros. When you install a new Linux distro, its bootloader should pick up the already installed distros. In case it doesn’t, just boot into the newly installed distro and run
|
||||
|
||||
grub2-mkconfig
|
||||
|
||||
Before running the command, make sure that the root partitions of the distros missing from the boot menu are mounted. If the distro you wish to add has **/root** and **/home** on separate partitions, only mount the partition that contains /root, before running the **grub2-mkconfig** command.
|
||||
|
||||
While Grub 2 will be able to pick most distros, trying to add a Fedora installation from within Ubuntu requires one extra step. If you’ve installed Fedora with its default settings, the distro’s installer would have created LVM partitions. In this case, you’ll first have to install the **lvm2** driver using the distro’s package management system, such as with
|
||||
|
||||
sudo apt-get install lvm2
|
||||
|
||||
before Grub 2’s **os-prober** script can find and add Fedora to the boot menu.
|
||||
|
||||
### Common user settings ###
|
||||
|
||||
Grub 2 has lots of configuration variables. Here are some of the common ones that you’re most likely to modify in the **/etc/default/grub** file. The **GRUB_DEFAULT** variable specifies the default boot entry. It will accept a numeric value such as 0, which denotes the first entry, or “saved” which will point it to the selected option from the previous boot. The **GRUB_TIMEOUT** variable specifies the delay before booting the default menu entry and the **GRUB_CMDLINE_LINUX** variable lists the parameters that are passed on the kernel command line for all Linux menu entries.
|
||||
|
||||
If the **GRUB_DISABLE_RECOVERY** variable is set to **true**, the recovery mode menu entries will not be generated. These entries boot the distro into single-user mode from where you can repair your system with command line tools. Also useful is the **GRUB_GFXMODE** variable, which specifies the resolution of the text shown in the menu. The variable can take any value supported by your graphics card.
|
||||
|
||||

|
||||
|
||||
**Grub 2 has a command line, which you can invoke by pressing C at the bootloader menu.**
|
||||
|
||||
#### Thorough fix ####
|
||||
|
||||
If the **grub2-install** command didn’t work for you, and you still can’t boot into Linux, you’ll need to completely reinstall and reconfigure the bootloader. For this task, we’ll use the venerable **chroot** utility to change the run environment from that of the live CD to the Linux install we want to recover. You can use any Linux live CD for this purpose as long as it has the **chroot** tool. However, make sure the live medium is for the same architecture as the architecture of the installation on the hard disk. So if you wish to **chroot** to a 64-bit installation you must use an amd64 live distro.
|
||||
|
||||
After you’ve booted the live distro, the first order of business is to check the partitions on the machine. Use **fdisk -l** to list all the partitions on the disk and make note of the partition that holds the Grub 2 installation that you want to fix.
|
||||
|
||||
Let’s assume we wish to restore the bootloader from the distro installed in **/dev/sda5**. Fire up a terminal and mount it with:
|
||||
|
||||
sudo mount /dev/sda5 /mnt
|
||||
|
||||
Now you’ll have to bind the directories that the Grub 2 bootloader needs access to in order to detect other operating systems:
|
||||
|
||||
$ sudo mount --bind /dev /mnt/dev
|
||||
$ sudo mount --bind /dev/pts /mnt/dev/pts
|
||||
$ sudo mount --bind /proc /mnt/proc
|
||||
$ sudo mount --bind /sys /mnt/sys
|
||||
|
||||
We’re now all set to leave the live environment and enter into the distro installed inside the **/dev/sda5** partition via **chroot**:
|
||||
|
||||
$ sudo chroot /mnt /bin/bash
|
||||
|
||||
You’re now all set to install, check, and update Grub. Just like before, use the
|
||||
|
||||
sudo grub2-install /dev/sda
|
||||
|
||||
command to reinstall the bootloader. Since the **grub2-install** command doesn’t touch the **grub.cfg** file, we’ll have to create it manually with
|
||||
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
That should do the trick. You now have a fresh copy of Grub 2 with a list of all the operating systems and distros installed on your machine. Before you can restart the computer, you’ll have to exit the chrooted system and unmount all the partitions in the following order:
|
||||
|
||||
$ exit
|
||||
$ sudo umount /mnt/sys
|
||||
$ sudo umount /mnt/proc
|
||||
$ sudo umount /mnt/dev/pts
|
||||
$ sudo umount /mnt/dev
|
||||
$ sudo umount /mnt
|
||||
|
||||
You can now safely reboot the machine, which should be back under Grub 2’s control, and the bootloader under yours!
|
||||
|
||||
### Add custom entries ###
|
||||
|
||||
If you wish to add an entry to the bootloader menu, you should add a boot stanza to the **40_custom** script. You can, for example, use it to display an entry to boot a Linux distro installed on a removable USB drive. Assuming your USB drive is **sdb1**, and the vmlinuz kernel image and the initrd files are under the root (/) directory, add the following to the **40_custom** file:
|
||||
|
||||
menuentry “Linux on USB” {
|
||||
set root=(hd1,1)
|
||||
linux /vmlinuz root=/dev/sdb1 ro quiet splash
|
||||
initrd /initrd.img
|
||||
}
|
||||
|
||||
For more accurate results, instead of device and partition names you can use their UUIDs, such as
|
||||
|
||||
set root=UUID=54f22dd7-eabe
|
||||
|
||||
Use
|
||||
|
||||
sudo blkid
|
||||
|
||||
to find the UUIDs of all the connected drives and partitions. You can also add entries for any distros on your disk that weren’t picked up by the os-prober script, as long as you know where the distro’s installed and the location of its kernel and initrd image files.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxvoice.com/grub-2-heal-your-bootloader/
|
||||
|
||||
作者:[Mayank Sharma][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linuxvoice.com/author/mayank/
|
47
translated/talk/20151202 KDE vs GNOME vs XFCE Desktop.md
Normal file
47
translated/talk/20151202 KDE vs GNOME vs XFCE Desktop.md
Normal file
@ -0,0 +1,47 @@
|
||||
translating by kylepeng93
|
||||
KDE,GNOME和XFCE的较量
|
||||
================================================================================
|
||||

|
||||
这么多年来,很多人一直都在他们的linux桌面端使用KDE或者GNOME桌面环境。这两个桌面环境经过多年的发展之后仍然在继续增加他们的用户基数。然而,在轻量级桌面环境下,XFCE一举成为了最受欢迎的桌面环境,相较于LXDE缺少的优美视觉效果,默认配置下的XFCE就可以在这方面打败前者。XFCE提供了用户能在GNOME2下使用的所有功能特性。但是,必须承认,在一些太老的计算机上,它的轻量级的特性并不能得到很好的效果。
|
||||
|
||||
### 桌面主题定制 ###
|
||||
用户完成安装之后,XFCE看起来可能会有一点无聊,因为它在视觉上还缺少一些吸引力。但是,请不要误解我的话,XFCE仍然拥有漂亮的桌面,可能看起来像是用户眼中的香草,正如大多数刚刚接触XFCE桌面环境的人。好消息是当我们给XFCE安装新的主题的时候,这会是一个十分容易的过程,因为你能够快速的找到你喜欢的XFCE主题,之后,你可以将它解压到一个合适的目录中。从这一点上来说,XFCE自带的一个重要的图形界面工具可以帮助用户更加容易的选中你已经选好的主题,这可能是目前在XFCE上最好用的工具了。如果用户按照上面的指示去做的话,对于任何想要尝试使用XFCE的用户来说将不存在任何困难。
|
||||
|
||||
在GNOME桌面上,用户也可以按照上面的方法去做。不过,其中最主要的不同点就是用户必须手动下载并安装GNOME Tweak Tool,这样才能继续你想做的事。当然,对于使用任何一种方式都不会有什么障碍,但是对于用户来说,使用XFCE安装和激活主题并不需要去额外的下载并安装任何tweak tool可能是他们无法忽略的一个优势。而在GNOME上,尤其是在用户已经下载并安装了GNOME Tweak tool之后,你仍将必须确保你已经安装了用户主题拓展。
|
||||
|
||||
在XFCE一样,用户将会去搜索并下载自己喜欢的主题,然后,用户可以重新使用GNOME Tweak tool,并点击该工具界面左边的Appearance按钮,接着用户便可以简单的通过点击相应的按钮并选择自己已经下载好的主题来使用自己的主题,当一切都完成之后,用户将会看到一个告诉用户已经成功应用了主题的对话框,这样,你的主题便已经安装完成。对于这一点,用户可以简单的使用滚动条来选择他们想要的主题。和XFCE一样,主题激活的过程也是十分简单的,然而,对于因为要使用一个新的主题而下载一个不被包含的应用的需求也是需要考虑的。
|
||||
|
||||
最后,就是KDE桌面主题定制的过程了。和XFCE一样,不需要去下载额外的工具来安装主题。从这点来看,让人有种XFCE必将使KDE成为最后的赢家的感觉。不仅在KDE上可以完全使用图形用户界面来安装主题,而且甚至只需要用户点击获取新主题的按钮就可以定位,查看,并且最后自动安装新的主题。
|
||||
|
||||
然而,我们不应该认为KDE相比XFCE是一个更加稳定的桌面环境。因此,现在正是我们思考为什么一些额外的功能可能会从桌面环境中移除来达到最小化的目的。为此,我们都必须为拥有这样出色的功能而给予KDE更多的支持。
|
||||
|
||||
### MATE不是一个轻量级的桌面环境 ###
|
||||
在继续比较XFCE,GNOME3和KDE之前,必须对这方面的老手作一个事先说明,我们不会将MATE桌面环境加入到我们的比较中。MATE可被认为是GNOME2的另一个衍生品,但是它并没有声称是作为一款轻量级或者快捷桌面。相反,它的主要目的是成为一款更加传统和舒适的桌面环境,并使它的用户感觉就像在家里使用它一样。
|
||||
|
||||
另一方面,XFCE生来就是要实现他自己的一系列使命。XFCE给它的用户提供一个更加轻量级的桌面环境,至今仍然有着吸引人的桌面视觉体验。然后,对于一些认为MATE也是一款轻量级的桌面环境的人来说,其实MATE真正的目标并不是成为一款轻量级的桌面环境。这两个选择在各自安装了一款好的主题之后看起来都会让人觉得非常具有吸引力。
|
||||
|
||||
### 桌面导航 ###
|
||||
XFCE在窗口之外提供了一个显眼的导航器。任何使用过传统的windows或者GNOME 2/MATE桌面环境的用户都可以在没有任何帮助的情况下自如的使用新安装的XFCE桌面环境的导航器。紧接着,添加小程序到面板中也是很明显的。和找到已经安装的应用程序一样,直接使用启动器并点击你想要运行的应用程序图标。除了LXDE和MATE之外,还没有其他的桌面的导航器可以做到如此简单。不仅如此,更加简单的是对控制面板的使用,对于刚刚使用这个新桌面的每个用户来说这是一个非常大的好处。如果用户更喜欢通过老式的方法去使用他们的桌面,对于GNOME来说,这不是一个问题。和没有最小化按钮形成的用户关注热点一样,加上其他应用布局方法,这将使新用户更加容易习惯这个风格设计。
|
||||
|
||||
如果用户来自windows桌面环境,那么这些用户将要放弃这些习惯,因为,他们将不能简单的通过鼠标右击一下就可以将一个小程序添加到他们的工作空间的顶部。与此相反,它可以通过使用拓展来实现。GNOME中的KDE拓展是可用的,并且是非常的容易,这些容易之处体现在只需要用户简单的使用位于GNOME拓展页面上的on/off开关。用户必须清楚,只能通过访问该页面才能使用这个功能。
|
||||
|
||||
另一方面,GNOME正在它的外观中体现它的设计理念,即为用户提供一个直观和易用的控制面板。你可能认为那并不是什么大事,但是,在我看来,它确实是我认为值得称赞并且有必要被提及的方面。KDE提供给它的用户大量传统的桌面使用体验,并通过提供相似的启动器和一种更加类似的获取软件的方式的能力来迎合来自windows的用户。添加小图标或者小程序到KDE桌面是件非常简单的事情,只需要在桌面的底部右击即可。只有在KDE的使用中才会存在的的问题,对于KDE用户寻找的很多KDE的特性实际上都是隐藏的。KDE的用户可能会指责这我的观点,但我仍然坚持我的说法。
|
||||
|
||||
为了增加小部件,仅仅在我的面板上右击就可以看见面板选项,但是并不是安装小部件的一个快速的方法。通常在你选择面板选项之前你都不会看到添加的小部件,然后,就添加小部件吧。这对我来说不是个问题,但是后来对于一些用户来说,它变成了不必要的困惑。而使事情变得更加复杂,用户管理定位部件区域后,他们后来发现一种称为“Activities”的品牌新术语。在同一地区的小部件,但它是在自己的领域是什么。
|
||||
|
||||
现在请不要误解我,KDE中的活动特性是很不错的,也是很有价值的,但是从可用性的角度看,为了不让新手感到困惑,它更加适合于应用在另一个目录选项。欢迎来自用户的分歧,,但为了测试这个新手对一些长时间的可以一遍又一遍的证明它是正确的。责骂放在一边,KDE添加新部件的方法的确很棒。与KDE的主题一样,用户不能通过使用提供的图形用户界面浏览和自动安装部件。这是一个神奇的功能,也可以是这样的方式去庆祝。KDE的控制面板可能和用户希望的样子不一样,它不是足够的简单。但是有一点很清楚,这将是他们致力于改进的地方。
|
||||
|
||||
### 因此,XFCE是最好的桌面环境,对吗? ###
|
||||
我在我的计算机上使用GNOME,KDE,并在我的办公室和家里的电脑上使用Xfce。我也有一些老机器在使用Openbox和LXDE。每一个使用桌面的经验都可以给我提供一些有用的东西,可以帮助我使用每台机器,因为我认为它是合适的。对我来说,在我的心里有一个柔软的地方,因为Xfce作为一个桌面环境,我坚持使用了很多年。但在这篇文章中,我只是在写我使用电脑的日常,事实上,它是GNOME。
|
||||
这篇文章的主要思想是我还是觉得Xfce能提供好一点的用户体验,对于那些正在寻找稳定的、传统的、容易理解的桌面环境的用户来说,XFCE是理想的。欢迎您在评论部分和我们分享你的意见。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/kde-vs-gnome-vs-xfce-desktop/
|
||||
|
||||
作者:[M.el Khamlichi][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/pirat9/
|
@ -0,0 +1,69 @@
|
||||
|
||||
# 学会Sed和Awk? 所有的Linux管理员都应该会的技能
|
||||
|
||||

|
||||
|
||||
图片来源: Shutterstock
|
||||
|
||||
**我们不希望下一代Linux和Unix的管理员忘记任何初始化脚本和基本工具的好处**
|
||||
|
||||
我曾经有一次在Reddit发表文章的机会, [asking about textfile manipulation][1].这是一个很简单请求,就像我们平时常用Unix的人所见到的。他的问题是,如何删除文件中的重复行,并保存在独立的实例里。 这听起来似乎很简单,但是当文件足够大时,就会有些复杂。
|
||||
|
||||
这个问题有很多种不同的答案。我怀疑你可以使用几乎任何一种语言来写这样的一个脚本,只是时间的投入和代码的复杂性不同罢了。根据你的个人水平,它大概会花费20-60分钟。但是如果你使用了Perl,Python,Ruby中的一种,你可能很快实现它。
|
||||
|
||||
或者你可以使用下面的一个方法,让你无比暖心的: 只用 awk.
|
||||
|
||||
这个答案是迄今为止最简明、最简单的解决问题的方法。他只要一行:
|
||||
|
||||
```
|
||||
awk '!seen[$0]++' <filename>.
|
||||
```
|
||||
|
||||
让我们来分析一下
|
||||
|
||||
在这段代码中,其实隐藏了很多代码。AWK是一种文本处理语言,并且他内部做了大量的假设。首先,你看到的实际上是一个循环的结果。Awk假定你想通过循环输入文件的每一行,所以你不需要明确的去设定它。Awk还假定了你需要打印数据的输出,所以你也不需要去指定它。最好,Awk假定循环在最后一句话执行完结束,这一块也不再需要你去指定它
|
||||
|
||||
这个例子中看到的字符串是一个关联的数组的名字。$0是一个变量,表示当前行的全部。所以,这个命令翻译成话就是“对这个文件的每一行进行检查,如果你之前没有见过他,就打印出来。”Awk通过做这些来看这个数组是否早已存在或值不相等的,这样就不匹配参数,下次就不会再打印了。
|
||||
|
||||
一些人认为这样是优雅的,另外的人认为这可能会造成混淆。任何在日常基础事情上使用Awk的都是第一类人。Awk就是被设计做这个的。在Awk中,你可以写多行。甚至是一些复杂的功能。你甚至可以[用awk写一些让人不安的复杂功能][2]。但,最终,Awk还是一个通过管道进行文字处理的程序。去除循环定义的外部缺陷是很常见的用法,你可以用下面的代码做同样的事情
|
||||
|
||||
|
||||
|
||||
```
|
||||
awk '{ if (!seen[$0]) print $0; seen[$0]++ }’
|
||||
```
|
||||
|
||||
这必将导致相同的结果
|
||||
|
||||
Awk是完成这项工作的完美工具。不过,我相信很多管理员--特别是新管理员会跳转到[Bash][ 3 ]或Python来完成这一任务,因为Awk的知识和他所能做的事情总是随着时间而褪色。我认为这是一个标识性的事情。几十年来,以前的解决方案总是缺乏对新的问题的处理方法
|
||||
|
||||
The shell, grep, sed, and awk 是Unix的计算基础.如果你不能非常轻松的使用他们,你将会变得十分脆弱。因为他们通过命令行和脚本的相互作用来实现。学习这些工具如何工作最好的方法之一就是观察和正在运行的范例一起工作,通过Unix系统特有的Init系统,或者在Linux发行版被称为 [systemd][4].
|
||||
|
||||
数以百万计的Unix管理员了解Shell脚本和Unix工具同读、写、修改和研究Init脚本。不同系统的Init脚本有很大不同,甚至是不同的发行版。但是他们都源自sh,而且他他们都用核心命令行工具像sed,awk还有grep
|
||||
|
||||
我每天都会挺到很多抱怨init脚本太“古老”而且很“难”。但是实际上,Init脚本和Unix管理员每天使用的工具一样,而且还提供了一个非常好的方式来更加熟悉和习惯这些工具。说Init脚本难的应该承认,你缺乏对Unix基础工具的熟悉。
|
||||
|
||||
说起在Reddit上的事情,我也碰到过这个问题,从一个初露头角的Linux系统管理员, [问他是否应该去学Sysvinit][5]. 大多数的答案都是好的方向--是的,应该学习sysvinit和systemd.一位评论者甚至指出,Init脚本是学习Bash的好方法。而另一个国家50强的公司不会搬到一个以系统为基础的发行版
|
||||
|
||||
但是,这提醒了我这是一个问题。如果我们继续沿着消除脚本和脱离我们操作系统的系统核心组件。由于出现的太少,我们将会不经意间的使新的管理员学习基本的Unix工具变得更难
|
||||
|
||||
我不知道为什么有些人想掩盖Unix内核抽象化和反抽象化,但是这样的一条路径可以减少一代Unix管理员出事后对服务支持的依赖。我相信这不是一件好事情。
|
||||
|
||||
------
|
||||
|
||||
via: http://www.infoworld.com/article/2985804/linux/remember-sed-awk-linux-admins-should.html
|
||||
|
||||
作者:[Paul Venezia][a]
|
||||
|
||||
译者:[Bestony](https://github.com/Bestony)
|
||||
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.infoworld.com/author/Paul-Venezia/
|
||||
[1]: https://www.reddit.com/r/linuxadmin/comments/3lwyko/how_do_i_remove_every_occurence_of_duplicate_line/
|
||||
[2]: http://intro-to-awk.blogspot.com/2008/08/awk-more-complex-examples.html
|
||||
[3]: http://www.infoworld.com/article/2613338/linux/linux-how-to-script-a-bash-crash-course.html
|
||||
[4]: http://www.infoworld.com/article/2608798/data-center/systemd--harbinger-of-the-linux-apocalypse.html
|
||||
[5]: https://www.reddit.com/r/linuxadmin/comments/3ltq2y/when_i_start_learning_about_linux_administration/
|
@ -1,62 +1,64 @@
|
||||
翻译中
|
||||
How to Install Light Table 0.8 in Ubuntu 14.04, 15.10
|
||||
如何在 Ubuntu 14.04, 15.10 中安装Light Table 0.8
|
||||
================================================================================
|
||||

|
||||
|
||||
The Light Table IDE has just reached a new stable release after more than one year of development. Now it provides 64-bit only binary for Linux.
|
||||
Light Table 在经过一年以上的开发,已经推出了新的稳定发行版本。现在它只为Linux提供64位的二进制包。
|
||||
LightTable 0.8.0的改动:
|
||||
|
||||
Changes in LightTable 0.8.0:
|
||||
|
||||
- CHANGED: We have switched to Electron from NW.js
|
||||
- CHANGED: LT’s releases and self-updating processes are completely in the open on Github
|
||||
- ADDED: LT can be built from source with provided scripts across supported platforms
|
||||
- ADDED: Most of LT’s node libraries are installed as npm dependencies instead of as forked libraries
|
||||
- ADDED: Significant documentation. See more below
|
||||
- FIX: Major usability issues on >= OSX 10.10
|
||||
- CHANGED: 32-bit linux is no longer an official download. Building from source will still be supported
|
||||
- FIX: ClojureScript eval for modern versions of ClojureScript
|
||||
- More details at [github.com/LightTable/LightTable/releases][1]
|
||||
- 更改: 我们从 NW.js 中选择了 Electron
|
||||
- 更改: LT’s 发行版本与自更新进程在github上面完全的公开
|
||||
- 增加: LT 可以由提供的脚本从源码在支持的不同平台上安装
|
||||
- 增加: LT’s 大部分的代码库将用npm依赖来安装以取代以forked库安装
|
||||
- 增加: 有效文档. 更多详情内容见下面
|
||||
- 修复: 版本号>= OSX 10.10的系统下工作的主要的可用性问题
|
||||
- 更改: 32位Linux不再提供官方包文件下载,从源码安装仍旧将被支持
|
||||
- 修复: ClojureScript eval 在ClojureScript的现代版本可以正常工作
|
||||
- 参阅更多 [github.com/LightTable/LightTable/releases][1]
|
||||
|
||||

|
||||
|
||||
### How to Install Light Table 0.8.0 in Ubuntu: ###
|
||||
### 如何在Ubuntu中安Light Table 0.8.0: ###
|
||||
|
||||
Below steps show you how to install the official binary in Ubuntu. Works on all current Ubuntu releases (**64-bit only**).
|
||||
下面的步骤回指导你怎么样在Ubuntu下安装官方的二进制包,在目前Ubuntu发行版本都适用(**仅仅针对64位**)。
|
||||
|
||||
Before getting started, please make a backup if you have a previous release installed.
|
||||
在开始之前,如果你安装了之前的版本请做好备份。
|
||||
|
||||
**1.** Download the Linux binary from link below:
|
||||
**1.**
|
||||
从以下链接下载LightTable Linux下的二进制文件:
|
||||
|
||||
- [lighttable-0.8.0-linux.tar.gz][2]
|
||||
|
||||
**2.** Open terminal from Unity Dash, App Launcher, or via Ctrl+Alt+T keys. When it opens, paste below command and hit enter:
|
||||
**2.**
|
||||
从dash或是应用启动器,或者是Ctrl+Alt+T快捷键打开终端,并且在输入以下命令后敲击回车键:
|
||||
|
||||
gksudo file-roller ~/Downloads/lighttable-0.8.0-linux.tar.gz
|
||||
|
||||

|
||||
|
||||
Install `gksu` from Ubuntu Software Center if the command does not work.
|
||||
如果命令不工作的话从Ubuntu软件中心安装`gksu`。
|
||||
|
||||
**3.** Previous command opens the downloaded archive via Archive Manager using root user privilege.
|
||||
**3.**
|
||||
之前的命令使用了root用户权限通过档案管理器打开了下载好的存档。
|
||||
|
||||
When it opens, do:
|
||||
|
||||
- right-click and rename the folder name to **LightTable**
|
||||
- extract it to **Computer -> /opt/** directory.
|
||||
打开它后,请做以下步骤:
|
||||
|
||||
- 右击文件并且将其重命名为 **LightTable**
|
||||
- 将其解压到 **Computer -> /opt/** 目录下。
|
||||
|
||||

|
||||
|
||||
Finally you should have the LightTable installed to /opt/ directory:
|
||||
最终你应该安装好了LightTable,可以在/opt/ 目录下查看:
|
||||
|
||||

|
||||
|
||||
**4.** Create a launcher so you can start LightTable from Unity Dash or App Launcher.
|
||||
**4.** 创建一个启动器使你可以从dash工具或是应用启动器打开LightTable。
|
||||
|
||||
Open terminal and run below command to create & edit a launcher file for LightTable:
|
||||
打开终端,运行以下命令来创建与编辑一个LightTable的启动文件:
|
||||
|
||||
gksudo gedit /usr/share/applications/lighttable.desktop
|
||||
|
||||
When the file opens via Gedit text editor, paste below and save the file:
|
||||
通过Gedit文本编辑器打开文件后, 粘贴下面的内容并保存:
|
||||
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
@ -84,11 +86,11 @@ When the file opens via Gedit text editor, paste below and save the file:
|
||||
Exec=/opt/LightTable/LightTable --command new_file
|
||||
OnlyShowIn=Unity;
|
||||
|
||||
So it looks like:
|
||||
因此它看起来像:
|
||||
|
||||

|
||||
|
||||
Finally launch the IDE from Unity Dash or Application Launcher and enjoy!
|
||||
最后,从dash工具或者是应用启动器打开IDE,好好享受它吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
235
translated/tech/20151229 Grub 2--Heal your bootloader.md
Normal file
235
translated/tech/20151229 Grub 2--Heal your bootloader.md
Normal file
@ -0,0 +1,235 @@
|
||||
Grub 2:拯救你的 bootloader
|
||||
================================================================================
|
||||
**没什么事比 bootloader 坏掉更让气人的了。充分发挥 Grub 2 的作用,让 bootloader 安分工作吧。**
|
||||
|
||||
为什么这么说?
|
||||
|
||||
- Grub 2 是最受欢迎的 bootloader ,受用于几乎所有 Linux 发行版。
|
||||
- bootloader 是一个至关重要的软件,但是非常容易损坏。
|
||||
- Grub 2 是具有扩展性和灵活性一款引导加载程序,提供了大量可定制选项。
|
||||
|
||||
Grub 2 是一款精彩的功能强大的软件。它不是 bootloader 界一枝独秀,但却最受欢迎,几乎所有主要的桌面发行版都在使用它。 Grub 的工作有两个。首先,它用一个菜单展示计算机上所有已经安装的操作系统供你选择。然后,当你从启动菜单中选择了一个 Linux 操作系统, Grub 便加载这个 Linux 的内核。
|
||||
|
||||
你知道,如果使用 Linux ,你就离不开 bootloader 。然而它却是 Linux 发行版内部最鲜为人知的部分。在这个教程里,我们将带你熟悉 Grub 2 一些著名的特性,强化你相关技能,使你在 bootloader 跑飞的时候能够自行处理。
|
||||
|
||||
Grub 2 最重要的特色在于大量的 text 格式文件和两个脚本文件。首先需要了解的是 **/etc/default/grub** 。这是一个 text 文件,你可以在里面设置通用配置变量和 Grub 2 菜单(见标题为 “Common user settings(普通用户设置)” 的窗口)的其它特性。
|
||||
|
||||
Grub 2 另一个重要的特点在于 **/etc/grub.d** 文件夹。定义菜单入口的所有脚本都放置在这里。这些脚本的名称必须有两位的数字前缀。其目的是,在构建 Grub 2 菜单时定义脚本的执行顺序以及相应入口的顺序。文件 **00_header** 首先被读取,负责解析 **/etc/default/grub** 配置文件。然后是 Linux 内核的入口,位于 **10_linux** 文件中。这个脚本在默认的 **/boot** 分区为每个内核创建一个正规菜单入口和一个恢复菜单入口。
|
||||
|
||||
紧接着的是为第三方应用所用的脚本,如 **30_os-prober** 和 **40_custom** 。 **os-prober** 脚本为内核和其它分区里的操作系统创建入口。它能识别 Linux、 Windows、 BSD 以及 Mac OS X 的装置(译注,指 bootloader )。 如果你的硬盘设计比较独特,使得 **os-prober** 无法捕获已经安装的发行版,你可以在 **40_custom** 文件(见 “Add custom entries(添加定制入口)”窗口)中添加入口。
|
||||
|
||||
**Grub** 2 不需要你手动维护你的启动选项的配置文件:取而代之的是使用 **grub2-mkconfig** 命令产生 **/boot/grub/grub.cfg** 文件。这个功能会解析 **/etc/grub.d** 目录中的脚本以及 **/etc/default/grub** 设置文件来定义你的安装。
|
||||
|
||||
图形化引导修复
|
||||
|
||||
多亏了 Boot Repair 应用,只需要点击按钮,Grub 2 许许多多的问题都能轻易解决。这个小巧的应用有一个直观的用户界面,可以扫描并包含多种硬盘设计和分区方案,还能发现并正确识别里面的操作系统的装置(译注,指 bootloader )。这个应用可以以主引导记录 (MBR)形式存在于传统计算机里,也可以在新型 UEFI 计算机中以 GUID(译改,应为GUID)分区表布局方式工作。
|
||||
|
||||
Boot Repair 最简单的使用方式是在 Live Ubuntu 会话中安装。在机器上用一个坏的 bootloader 启动 Ubuntu Live 发行版,通过首次添加它的 PPA 版本库,安装 Boot Repair ,命令如下
|
||||
|
||||
sudo add-apt-repository ppa:yannubuntu/Boot Repair
|
||||
|
||||
然后刷新版本库列表,使用
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
安装应用(译改,删了 before ),如下
|
||||
|
||||
sudo apt-get install -y Boot Repair
|
||||
|
||||
安装完毕立刻启动应用。在显示它的界面(由一对按键组成)之前将会扫描你的硬盘。根据工具的指示,只需按下 Recommended Repair(推荐修复)按钮,即可修复大部分坏掉的 bootloader 。修复 bootloader 之后,这个工具会输出一串短小的 URL ,你应该把它记录下来。这个 URL 包含了硬盘详尽的信息:分区信息以及 Grub 2 重要的文件(如 **/etc/default/grub** 和 **boot/grub/grub.cfg** )的内容。如果工具不能解决 bootloader 的问题,可以把你这个 URL 共享在你的发行版的论坛公告牌上,让其他人分析你的硬盘设计以便给你建议。
|
||||
|
||||

|
||||
|
||||
**Boot Repair 同样支持定制 Grub 2 的选项。**
|
||||
|
||||
#### Bootloader 急救 ####
|
||||
|
||||
Grub 2 引导问题会导致系统处于几种不同状态。屏幕(如你所想,本该显示 bootloader 菜单的地方)所展示的文本,指示系统的当前状态。如果系统中止于 **grub>** 提示符,表明 Grub 2 模块已经被加载,但是找不到 **grub.cfg** 文件。当前是全 Grub 2 命令shell,你可以通过多种方式解决此问题。如果你看到的是 **grub rescue>** 提示符,表明 bootloader 不能找到 Grub 2 模块或者找不到任何引导文件( boot files )。然而,如果你的屏幕只显示 ‘GRUB’ 一词,表明 bootloader 找不到通常位于主引导记录( Master Boot Record )里的最基本的信息。
|
||||
|
||||
你可以通过使用 live CD 或者在 Grub 2 shell中修正此类错误。如果你够幸运, bootloader 中止于 **grub>** 提示符,你将能获得 Grub 2 shell 的支配权,来帮助你排错。
|
||||
|
||||
接下来几个命令工作在 **grub>** 和 **grub rescue>** 提示符下。 **set pager=1** 命令产生分页器( pager ),防止文本在屏幕上被刷掉。你还可以使用 **ls** 命令列出 Grub 识别的分区,如下:
|
||||
|
||||
grub> ls
|
||||
(hd0) (hd0,msdos5) (hd0,msdos6) (hd1,msdos1)
|
||||
|
||||
如你所见,这个命令列出分区的同时一并列出了分区表计划。
|
||||
|
||||
你还可以在每个分区上面使用 **ls** 来查找根文件系统:
|
||||
|
||||
grub> ls (hd0,5)/
|
||||
lost+found/ var/ etc/ media/ bin/ initrd.gz
|
||||
boot/ dev/ home/ selinux/ srv/ tmp/ vmlinuz
|
||||
|
||||
你可以不写上分区名的 **msdos** 位。同样,如果你忘记尾斜杠( the trailing slash )只输入 **ls (hd0,5)** ,那你将获得分区的信息比如文件系统类型,总体大小和最后修改时间。如果你有多个分区,可以使用 **cat** 读取 **/etc/issue** 文件中的内容,来确定发行版,格式如 **cat (hd0,5)/etc/issue** 。
|
||||
|
||||
假设你在 **(hd0,5)** 中找到根文件系统,请确保它包含 /**boot/grub** 目录,以及你想引导进入的内核镜像,如 **vmlinuz-3.13.0-24-generic** 。此时输入以下命令:
|
||||
|
||||
grub> set root=(hd0,5)
|
||||
grub> linux /boot/vmlinuz-3.13.0-24-generic root=/dev/sda5
|
||||
grub> initrd /boot/initrd.img-3.13.0-24-generic
|
||||
|
||||
第一个命令把 Grub 指向我们想引导进入的发行版所在的分区。接着第二个命令告知 Grub 内核镜像在分区中的位置,以及根文件系统的位置。最后一行设置虚拟文件系统( initial ramdisk )文件的位置。你可以使用 tab 补全功能补全内核名字和虚拟文件系统( initrd: initial ramdisk )名字,节省时间和精力。
|
||||
|
||||
输入完毕,在下一个 **grub>** 提示符后输入 **boot** , Grub 将会引导进入指定的操作系统。
|
||||
|
||||
在 **grub rescue>** 提示符下,情况会有些许不同。因为 bootloader 未能够找到并加载任何必需的模块,你需要手动添加这些模块:
|
||||
|
||||
grub rescue> set root=(hd0,5)
|
||||
grub rescue> insmod (hd0,5)/boot/grub/normal.mod
|
||||
grub rescue> normal
|
||||
grub> insmod linux
|
||||
|
||||
如上所示,跟之前一样,使用 **ls** 命令列出所有分区之后,使用 **set** 命令标记起来。然后添加 **normal** 模块,此模块激活时将会恢复标准 **grub>** 模式。如果 linux 模块没加载,接下来的命令会进行添加。如果这个模块已经加载,你可以跟之前一样,把引导加载程序指向内核镜像和虚拟文件系统( initrd )文件,然后使用 **boot** 启动发行版,完美收官。
|
||||
|
||||
一旦成功启动发行版,别忘了为 Grub 重新产生新的配置文件,使用
|
||||
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
命令。你还需要往 MBR 里安装一份 bootloader 的拷贝,使用
|
||||
|
||||
sudo grub2-install /dev/sda
|
||||
|
||||
命令。
|
||||
|
||||

|
||||
|
||||
**想要禁能 /etc/grub.d 目录下的脚本,你只需移除可执行位,比如使用 chmod -x /etc/grub.d/20_memtest86+ 就能将 ‘Memory Test’ 选项从菜单中移除。**
|
||||
|
||||
### Grub 2 和 UEFI ###
|
||||
|
||||
支持UEFI的机器(最近几年上市的机器大部分都是)添加了另一复杂的层次,用以调试坏掉的 **Grub 2**。恢复 **Grub 2** 的程序在 UEFI 机器上安装和在非 UEFI 机器上安装并没多大区别,只是新程序处理方式不一样,从而导致了很多种恢复结果。
|
||||
|
||||
对于基于 UEFI 的系统,不要在 MBR上安装任何东西。相反,你要在 EFI 系统分区( ESP )里安装 EFI bootloader,并且借助工具把它设置为 EFI 的默认启动程序,这个工具对于 Linux 用户是 **efibootmgr** ,对于 window 用户则是 **bcdedit** 。
|
||||
|
||||
照目前情况看,在安装任何与 Windows 8 兼容的主流桌面 Linux 发行版前, Grub 2 应该完成正确安装。然而,如果 bootloader 损坏,你可以使用 live 发行版进行机器修复。在启动 live 媒介之时,请确保是以 UEFI模式启动。计算机每个可移动驱动的启动菜单将会有两个选项: vanilla 选项和以 EFI 标记的选项。使用后者开放 **/sys/firmware/efi/** 文件中的 EFI 变量。
|
||||
|
||||
在 live 环境中,挂载教程前面所提的安装失败的装置(译注,指 bootloader )的根文件系统。除此之外,还需要挂载 ESP 分区。假设分区是 **/dev/sda1** ,你可以如下所示挂载
|
||||
|
||||
sudo mount /dev/sda1 /mnt/boot/efi
|
||||
|
||||
接着在 chroot 到安装完毕的发行版前之前,使用 **modprobe efivars** 加载 **efivars** 模块。
|
||||
|
||||
这个时候, Fedora 用户使用如下命令重新安装 bootloader
|
||||
|
||||
yum reinstall grub2-efi shim
|
||||
|
||||
在此之前,需要使用
|
||||
|
||||
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
来产生新的配置文件。 Ubuntu 用户则改用以下命令
|
||||
|
||||
apt-get install --reinstall grub-efi-amd64
|
||||
|
||||
一旦 bootloader 正确就位,退出 chroot ,取消挂载所有分区,重启让 Grub 2 菜单显示。
|
||||
|
||||
#### 伙计,我的 Grub 哪去了? ####
|
||||
|
||||
Grub 2 最好的特性是可以随时重新安装。因此,当其它像 Windows 之类的系统用自己的 bootloader 替换之,导致 Grub 2 丢失,你可以使用 live 发行版,寥寥数步即可重装 Grub 。假设你在 **/dev/sda5** 安装了一个发行版,若要重装 Grub ,你只需首先使用以下命令,为发行版创建一个挂载目录
|
||||
|
||||
sudo mkdir -p /mnt/distro
|
||||
|
||||
然后挂载分区,如下
|
||||
|
||||
mount /dev/sda5 /mnt/distro
|
||||
|
||||
接着就能重装 Grub 了,如下
|
||||
|
||||
grub2-install --root-directory=/mnt/distro /dev/sda
|
||||
|
||||
这个命令会改写 **/dev/sda** 设备上的 MBR 信息,指向当前 Linux 的装置(译注,指 bootloader ),并改写 Grub 2 部分文件如 **grubenv** 和 **device.map** 。
|
||||
|
||||
另一个问题常见于装有多个发行版的计算机上。安装了新的 Linux 发行版,它的 bootloader 应当要能捕获所有已经安装的发行版。一旦不能够,只要引导进入新安装的发行版,并运行
|
||||
|
||||
grub2-mkconfig
|
||||
|
||||
运行命令之前,请确保发行版的启动菜单中缺失的 root 分区已经完成挂载。如果你想添加的发行版有独立 **/root** 和 **/home** 分区,在运行 **grub2-mkconfig** 之前,只需挂载包含 /root 的分区。
|
||||
|
||||
虽然 Grub 2 能够捕获大部分发行版,但是在 Ubuntu 中尝试添加 Fedora 的装置(译注,指 bootloader )需要额外的一个步骤。如果你以默认设置安装了 Fedora ,则发行版的安装器(译注,同样指 bootloader )已经创建了 LVM 分区。此时你需要使用发行版的包管理系统,安装 **lvm2** 驱动,如下
|
||||
|
||||
sudo apt-get install lvm2
|
||||
|
||||
才能使得 Grub 2 的 **os-prober** 脚本能够找到并将 Fedora 添加进启动菜单。
|
||||
|
||||
### 普通用户设置 ###
|
||||
|
||||
Grub 2 有很多可配置变量。 **/etc/default/grub** 文件里有很多你最可能会修改到的普通变量。 **GRUB_DEFAULT** 变量指定默认的启动入口,可以设置为数字值,比如 0 ,表示第一个入口,或者设置为 “saved” ,将它从指向上一次启动时选中的选项。 **GRUB_TIMEOUT** 变量指定启动默认菜单入口之前的停留时间。 **GRUB_CMDLINE_LINUX** 为所有 Linux 菜单入口列出在内核命令行上传递的参数。
|
||||
|
||||
如果 **GRUB_DISABLE_RECOVERY** 变量设置为 **true** ,那么将不产生恢复模式菜单入口。这些入口以单用户模式启动发行版,这种模式下允许你利用命令行工具修复系统。 **GRUB_GFXMODE** 变量同样有用,它指定了菜单上文本显示的分辨率,它可以设置为你的显卡所支持的任何数值。
|
||||
|
||||

|
||||
|
||||
** Grub 2 有其命令行,通过在 bootloader 菜单上按 C 调用。**
|
||||
|
||||
#### 彻底的修复 ####
|
||||
|
||||
如果 **grub2-install** 命令不能正常运作,使得你无法引导进入 Linux ,你需要完整地重装以及重新配置 bootloader 。为此目的,需要用到神圣的 **chroot** 应用将 live CD 环境切换至并运行我们想修复的 Linux 的安装环境。任何拥有 **chroot** 工具的 Linux live CD 都可以实现这个目的。不过需要确保 live 媒介的架构和硬盘上系统的架构一致。因此当你希望 **chroot** 到 64 位系统,你必须使用 amd64 live 发行版。
|
||||
|
||||
启动进入 live 发行版之后,首先需要检查机器上的分区。使用 **fdisk -l** 列出磁盘上所有分区,记录你想修复的 Grub 2 装置所在的分区。
|
||||
|
||||
假设我们希望从安装在 **/dev/sda5** 中的发行版中恢复 bootloader 。启动终端使用如下命令挂载分区:
|
||||
|
||||
sudo mount /dev/sda5 /mnt
|
||||
|
||||
此时需要绑定 Grub 2 bootloader 需要进入的目录,以便检测其它操作系统:
|
||||
|
||||
$ sudo mount --bind /dev /mnt/dev
|
||||
$ sudo mount --bind /dev/pts /mnt/dev/pts
|
||||
$ sudo mount --bind /proc /mnt/proc
|
||||
$ sudo mount --bind /sys /mnt/sys
|
||||
|
||||
此时可以离开 live 环境进入安装在 **/dev/sda5** 分区中的发行版了,通过 **chroot** :
|
||||
|
||||
$ sudo chroot /mnt /bin/bash
|
||||
|
||||
现在可以安装、检测、以及升级 Grub 了,跟之前一样,使用
|
||||
|
||||
sudo grub2-install /dev/sda
|
||||
|
||||
命令来重装 bootloader 。因为 **grub2-install** 命令不能 创建**grub.cfg** 文件,需要手动创建,如下
|
||||
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
这样应该就可以了。现在你就有了 Grub 2 的一份全新拷贝,罗列机器上所有的操作系统和发行版。在重启电脑之前,你需要依次退出 chroot 系统,卸载所有分区,如下所示:
|
||||
|
||||
$ exit
|
||||
$ sudo umount /mnt/sys
|
||||
$ sudo umount /mnt/proc
|
||||
$ sudo umount /mnt/dev/pts
|
||||
$ sudo umount /mnt/dev
|
||||
$ sudo umount /mnt
|
||||
|
||||
现在你可以安全地重启电脑了,而它应该会回退到 Grub 2 的控制之中,而你又控制着这个 bootloader 。
|
||||
|
||||
### 添加自定义入口 ###
|
||||
|
||||
如果希望往 bootloader 菜单里添加入口,你需要在 **40_custom** 文件里添加一个启动段( boot stanza )。例如,你可以使用它展示一个入口来启动安装在可移动 USB 驱动里的 Linux 发行版。假设你的 USB 驱动是 **sdb1** ,并且 vmlinuz 内核镜像和虚拟文件系统( initrd )都位于根 (/)目录下,在 **40_custom** 文件中添加以下内容:
|
||||
|
||||
menuentry “Linux on USB” {
|
||||
set root=(hd1,1)
|
||||
linux /vmlinuz root=/dev/sdb1 ro quiet splash
|
||||
initrd /initrd.img
|
||||
}
|
||||
|
||||
相比使用设备和分区名,使用它们的 UUID 可以获得更精确结果,比如
|
||||
|
||||
set root=UUID=54f22dd7-eabe
|
||||
|
||||
使用
|
||||
|
||||
sudo blkid
|
||||
|
||||
来获得所有已连接驱动和分区的 UUID 。你还可以为你磁盘上没被 os-prober 脚本捕获的发行版添加入口,只要你知道该发行版的安装位置以及其内核和虚拟文件系统( initrd )的定位即可。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxvoice.com/grub-2-heal-your-bootloader/
|
||||
|
||||
作者:[Mayank Sharma][a]
|
||||
译者:[soooogreen](https://github.com/soooogreen)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linuxvoice.com/author/mayank/
|
@ -1,15 +1,20 @@
|
||||
如何在 UNIX 中根据文件内容查找文件
|
||||
How To Find Files by Content Under UNIX
|
||||
================================================================================
|
||||
为了完成课程作业,我写了很多 C 语言代码并把它们保存为 /home/user/c/*.c and *.h。那么在 UNIX shell 窗口中我如何能通过字符串或者单词(例如函数名 main())文件内容来查找文件呢?
|
||||
I had written lots of code in C for my school work and saved it as source code under /home/user/c/*.c and *.h. How do I find files by content such as string or words (function name such as main() under UNIX shell prompt?
|
||||
|
||||
你需要用到以下工具:
|
||||
You need to use the following tools:
|
||||
|
||||
[a] **grep command** : print lines matching a pattern.
|
||||
[a] **grep 命令** : 输出匹配模式的行。
|
||||
|
||||
[b] **find command**: search for files in a directory hierarchy.
|
||||
[b] **find 命令**: 在目录层次中查找文件。
|
||||
|
||||
### [使用 grep 命令根据内容查找文件][1]
|
||||
### [grep Command To Find Files By][1] Content ###
|
||||
|
||||
输入以下命令:
|
||||
Type the command as follows:
|
||||
|
||||
grep 'string' *.txt
|
||||
@ -19,36 +24,48 @@ Type the command as follows:
|
||||
grep -i 'ultra' *.conf
|
||||
grep -iR 'ultra' *.conf
|
||||
|
||||
其中
|
||||
Where
|
||||
|
||||
- **-i** : 忽视模式(匹配字符串 valid、 VALID、 ValID )和输入文件(匹配 file.c FILE.c FILE.C)的大小写。
|
||||
- **-R** : 递归读取每个目录下的所有文件。
|
||||
- **-i** : Ignore case distinctions in both the PATTERN (match valid, VALID, ValID string) and the input files (math file.c FILE.c FILE.C filename).
|
||||
- **-R** : Read all files under each directory, recursively
|
||||
|
||||
### 高亮匹配到的模式 ###
|
||||
### Highlighting searched patterns ###
|
||||
|
||||
在搜索大量文件的时候你可以轻松地高亮模式:
|
||||
You can highlight patterns easily while searching large number of files:
|
||||
|
||||
$ grep --color=auto -iR 'getChar();' *.c
|
||||
|
||||
### 为查找到的模式显示文件名和行号 ###
|
||||
### Displaying file names and line number for searched patterns ###
|
||||
|
||||
你也许需要显示文件名和行号:
|
||||
You may also need to display filenames and numbers:
|
||||
|
||||
$ grep --color=auto -iRnH 'getChar();' *.c
|
||||
|
||||
其中,
|
||||
Where,
|
||||
|
||||
- **-n** : 在输出的每行前面添加文件中以 1 开始的行号。
|
||||
- **-H** : 为每个匹配打印文件名。要搜索多个文件时这是默认选项。
|
||||
- **-n** : Prefix each line of output with the 1-based line number within its input file.
|
||||
- **-H** Print the file name for each match. This is the default when there is more than one file to search.
|
||||
|
||||
$grep --color=auto -nH 'DIR' *
|
||||
|
||||
输出样例:
|
||||
Sample output:
|
||||
|
||||

|
||||

|
||||
|
||||
Fig.01: grep command displaying searched pattern
|
||||
Fig.01: grep 命令显示搜索到的模式
|
||||
|
||||
你也可以使用 find 命令:
|
||||
You can also use find command:
|
||||
|
||||
$ find . -name "*.c" -print | xargs grep "main("
|
||||
@ -58,7 +75,7 @@ You can also use find command:
|
||||
via: http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/
|
||||
|
||||
作者:Vivek Gite
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user