20131101-1 选题

This commit is contained in:
DeadFire 2013-11-01 11:07:41 +08:00
parent cd19dfe18b
commit 5674237a56
4 changed files with 358 additions and 0 deletions

View File

@ -0,0 +1,65 @@
How to Control Your Linux PC with an Android Device
================================================================================
**The following tutorial will teach all Linux users how to install SSH on their systems, in order to access their computers remotely from an Android tablet of smartphone.**
![](http://i1-news.softpedia-static.com/images/news2/How-to-Control-Your-Linux-PC-with-an-Android-Device-396004-2.jpg)
These days we all have a tablet or phablet device, and we often find ourselves later at night watching a movie or TV show, listening to music, or reading a good book. You can call this article a tutorial for the lazy, for people who are too tired at night to start some process(es) on their computer, move, delete, copy or rename some files, or even to shutdown their PC.
Yes, there are all sorts of remote desktop solutions out there, but many costs a fortune or are badly implemented and don't work as expected, forcing you to go to the PC after all and do the stuff you want to do.
For this tutorial we will use a simple, secure and effective protocol called SSH (Secure Shell), which can be easily installed from your default software repositories (openssh in Arch Linux, or openssh-server in Ubuntu).
### Configuring the SSH server ###
After installation, you will need to do basic configuration for the SSH server. For this, you need to edit the /etc/ssh/sshd_config file with a text editor.
1. Add the following line (where yourusername will be replaced with your actual username on your Linux box) at the end of the file:
AllowUsers yourusername
2. Uncomment the "#PermitRootLogin yes" line and add "no" instead of "yes" making it look like this:
PermitRootLogin no
2. For security reasons, you need to modify the 22 port, which is used by default on SSH connections, to a higher port, such as 55441 in our example below (but don't use 55441, be original, find another five or four digit number). To do this, uncomment and edit the "#Port 22" line to look like this:
Port 55441
### Starting the SSH server ###
On Ubuntu, the SSH service can be started using the following command:
sudo /etc/init.d/ssh start
...and every time you make modifications to the aforementioned configuration file, you can restart it using the following command:
sudo /etc/init.d/ssh restart
On Arch Linux you can start the SSH service using the following command:
sudo systemctl start sshd
### Configuring the SSH client on your Android device ###
One of the best SSH clients for Android appears to be JuiceSSH, which is free, but those who find it poor in functionality, can pay a small amount of money for more advanced features, such as Amazon AWS/EC2 integration, team collaboration, and much more.
Once the software is installed, open it and you will be asked to add an encryption password, which will keep your connections safe, encrypted with AES-256 so no one can access them in case your device is stolen.
![](http://i1-news.softpedia-static.com/images/extra/LINUX/large/sshlinuxandroid-large_001.jpg)
Now, add a new connection by choosing a name, the IP address of your computer, the port set above, and an identity, which needs to be created...
![](http://i1-news.softpedia-static.com/images/extra/LINUX/large/sshlinuxandroid-large_002.jpg)
![](http://i1-news.softpedia-static.com/images/extra/LINUX/large/sshlinuxandroid-large_003.jpg)
...and here's my Arch Linux box, as viewed from the JuiceSSH client on my Android tablet. Do not hesitate to comment below if you run into problems during this tutorial.
--------------------------------------------------------------------------------
via: http://news.softpedia.com/news/How-to-Control-Your-Linux-PC-with-an-Android-Device-396004.shtml
译者:[译者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,117 @@
Linux Pmap Command Find How Much Memory Process Use
================================================================================
Pmap provide memory map of a process, The pmap command display the memory usage map of a process or multiple processes. Pmap reports information about the address space or memory usage map of a process. Pmap is actually a Sun OS command and Linux supports only very limited number of features. But it is very helpful for finding the complete address space of a process. To check [memory usage of process][1] we need PID or unique process ID of running process, we can get PID from /proc or regular commands like top or ps.
### Syntax or usage ###
#pmap PID
or
#pmap [options] PID
In outout it display total address, kbytes, mode and mapping.
### Options ###
-x extended Show the extended format.
-d device Show the device format.
-q quiet Do not display some header/footer lines.
-V show version Displays version of program.
### Memory usage map of single process ###
[root@info ~]# pmap 1013
1013: /usr/sbin/sshd
00110000 1480K r-x /usr/lib/libcrypto.so.1.0.0
00282000 80K rw— /usr/lib/libcrypto.so.1.0.0
00296000 12K rw— [ anon ]
00299000 36K r-x /lib/libkrb5support.so.0.1
002a2000 4K rw— /lib/libkrb5support.so.0.1
002a3000 16K r-x /lib/libplc4.so
002a7000 4K rw— /lib/libplc4.so
002ab000 88K r-x /lib/libaudit.so.1.0.0
002c1000 4K r—- /lib/libaudit.so.1.0.0
002c2000 4K rw— /lib/libaudit.so.1.0.0
002c3000 216K r-x /lib/libgssapi_krb5.so.2.2
002f9000 4K rw— /lib/libgssapi_krb5.so.2.2
002fa000 808K r-x /lib/libkrb5.so.3.3
003c4000 24K rw— /lib/libkrb5.so.3.3
003ca000 152K r-x /lib/libk5crypto.so.3.1
003f0000 4K rw— /lib/libk5crypto.so.3.1
003f1000 92K r-x /usr/lib/libnssutil3.so
00738000 4K r—- /lib/libresolv-2.12.so
00739000 4K rw— /lib/libresolv-2.12.so
0073a000 8K rw— [ anon ]
00825000 120K r-x /lib/ld-2.12.so
00843000 4K r—- /lib/ld-2.12.so
00844000 4K rw— /lib/ld-2.12.so
0090d000 32K r-x /lib/libwrap.so.0.7.6
00915000 4K rw— /lib/libwrap.so.0.7.6
00948000 484K r-x /usr/sbin/sshd
009c1000 8K rw— /usr/sbin/sshd
009c3000 20K rw— [ anon ]
009e0000 92K r-x /lib/libpthread-2.12.so
009f7000 4K r—- /lib/libpthread-2.12.so
total 8232K
### Memory usage map of multiple processes ###
We can check memory map of multiple processes by inserting multiple PIDs. Add multiple PIDs with adding space.
pmap 1013 1217 1118
### Extended memory map about a process ###
[root@info ~]# pmap -x 1013
1013: /usr/sbin/sshd
Address Kbytes RSS Dirty Mode Mapping
00110000 1480 92 0 r-x libcrypto.so.1.0.0
00282000 80 80 80 rw— libcrypto.so.1.0.0
00296000 12 8 4 rw— [ anon ]
00299000 36 0 0 r-x libkrb5support.so.0.1
002a2000 4 4 4 rw— libkrb5support.so.0.1
002a3000 16 0 0 r-x libplc4.so
002a7000 4 4 4 rw— libplc4.so
002ab000 88 4 0 r-x libaudit.so.1.0.0
002c1000 4 4 4 r—- libaudit.so.1.0.0
002c2000 4 4 4 rw— libaudit.so.1.0.0
002c3000 216 4 0 r-x libgssapi_krb5.so.2.2
002f9000 4 4 4 rw— libgssapi_krb5.so.2.2
002fa000 808 4 0 r-x libkrb5.so.3.3
003c4000 24 24 24 rw— libkrb5.so.3.3
003ca000 152 4 0 r-x libk5crypto.so.3.1
003f0000 4 4 4 rw— libk5crypto.so.3.1
003f1000 92 0 0 r-x libnssutil3.so
00408000 12 12 12 rw— libnssutil3.so
0040b000 12 0 0 r-x libplds4.so
0040e000 4 4 4 rw— libplds4.so
——– ——- ——- ——- ——-
total kB 8232 -
Here Address, Kbyte, Dirty, RSS, mode and mapping containd information as below
### Extended and Device Format Fields ###
Address: start address of map
Kbytes: size of map in kilobytes
RSS: resident set size in kilobytes
Dirty: dirty pages (both shared and private) in kilobytes
Mode: permissions on map: read, write, execute, shared, private (copy on write)
Mapping: file backing the map, or [ anon ] for allocated memory, or [ stack ] for the program stack
Offset: offset into the file
Device: device name (major:minor)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/pmap-command/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.linoxide.com/linux-shell-script/linux-memory-usage-program/

View File

@ -0,0 +1,108 @@
Options in Linux RPM Command to Query Packages
================================================================================
RPM is RedHat Package Manager, used to install/remove/update and query the packages in Red Hat based linux. RHEL and the systems based on it uses rpm command to do that. The following example demonstrates the use of rpm query feature and shows different ways you can query rpm database and restore configuration file.
I have included the SSH package to in the example commands.
### Query RPM Database and Packages ###
**1、 To query the whole RPM database, use the following command.**
# rpm -qa
plymouth-0.8.3-27.el6.x86_64
pciutils-libs-3.1.10-2.el6.i686
netcf-libs-0.1.9-3.el6.x86_64
..
..
Output Truncated
**2、 You can identify the package from which SSH is installed by using grep on the above example.**
# rpm -qa |grep ssh
libssh2-1.4.2-1.el6.x86_64
openssh-askpass-5.3p1-84.1.el6.x86_64
libssh2-1.4.2-1.el6.i686
openssh-server-5.3p1-84.1.el6.x86_64
openssh-clients-5.3p1-84.1.el6.x86_64
openssh-5.3p1-84.1.el6.x86_64
The output shows other packages related to ssh but you have to still identify that which package is actually installing SSH. To further break it down see the next example.
**3、 Check the installed package of SSH a) from sshd daemon b) from its configuration file.**
# rpm -qf /etc/init.d/sshd
openssh-server-5.3p1-84.1.el6.x86_64
# rpm -qf /etc/ssh/sshd_config
openssh-server-5.3p1-84.1.el6.x86_64
As you can see the ssh is installed from the openssh-server-5.3p1-84.1.el6.x86_64 package. You can use rpm -qf command both on daemon and a configuration file. Both will output the package it is installed from.
**4、 Now that you have the package name, you may want to explore more on it and want to know what are the various files this package contains. For that use rpm -ql command.**
# rpm -ql openssh-server-5.3p1-84.1.el6.x86_64
/etc/pam.d/ssh-keycat
/etc/pam.d/sshd
/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
/usr/libexec/openssh/sftp-server
/usr/libexec/openssh/ssh-keycat
/usr/sbin/.sshd.hmac
/usr/sbin/sshd
/usr/share/doc/openssh-server-5.3p1
/usr/share/doc/openssh-server-5.3p1/HOWTO.ssh-keycat
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz
/var/empty/sshd
he above output is showing all the files that this package installed on the system. Now lets even break it down and we only want to see the configuration files and document files supplied with this package.
**5、 To list only the configuration files use the rpm -qc command.**
# rpm -qc openssh-server-5.3p1-84.1.el6.x86_64
/etc/pam.d/ssh-keycat
/etc/pam.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
**6、 To list only documentation files use rpm -qd command**
# rpm -qd openssh-server-5.3p1-84.1.el6.x86_64
/usr/share/doc/openssh-server-5.3p1/HOWTO.ssh-keycat
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz
Consider a situation in which you want to configure a service, but you dont know where to find the configuration files. As an example, Consider the above example: Use **rpm -qf rpm -qf /etc/init.d/sshd** to find out from what package the **/etc/ssh/sshd_config** file originated. It should show you the **openssh-server-5.3p1-84.1.el6.x86_64** package. Use **rpm -ql openssh-server-5.3p1-84.1.el6.x86_64** to show a list of all the files in this package. As you can see, the names of many files are displayed, but the output is not very useful.
Now use **rpm -qc openssh-server-5.3p1-84.1.el6.x86_64** to show just the configuration files used by this package. This shows a list of four files only and gives you the absolute path of [/etc/ssh/sshd_config file][1] to start configuring the service.
**7、 Restore configuration file from RPM Package, without reinstalling a package.**
If for some reason a file has been damaged or got deleted from system, you can start with the **rpm -qf** query option to find out from what package the file originated. Next use **rpm2cpio | cpio -idmv** to extract the files from the package. Consider the ssh example:
Assuming that the **/etc/ssh/sshd_config** file has been deleted and you may not want to reinstall ssh, Restore the file using the steps below.
* Use rpm -qf /etc/init.d/sshd This command shows that the file comes from the openssh-server-5.3p1-84.1.el6.x86_64 Package.
* Download the Openssh rpm from its source
* Copy openssh-server-5.3p1-84.1.el6.x86_64 package file to /tmp directory or any other directory of your choice.
* Use rpm2cpio |cpio -idmv to extract the package.
The command you used in the above step created a few subdirectories in /tmp. You can now copy it to its original location.
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/rpm-command-query/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.linoxide.com/how-tos/disable-ssh-direct-login/

View File

@ -0,0 +1,68 @@
Save, Access And Quickly Paste Text Snippets With This Nifty Unity Launcher Tool
================================================================================
**Repeatedly typing out certain information like e-mail or home addresses, verbose terminal commands, and well timed quotes from cult TV shows can be a chore.**
![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/10/Screen-Shot-2013-10-31-at-13.04.jpg)
*Snippets Handy Way to Access Stored Text*
Thankfully there are tools out there to help.
*Snippets* is one such utility for Unity. Its a simple Launcher item that lets you save and store excerpts in a text file, then, when needed, select them from a Unity Quicklist to copy them the clipboard.
Now before anyone throws their underwear at me in disgust, Im well aware Snippets is not unique or the first in offering this sort of feature. But what it is unique in doing is offering it through a Unity Launcher item.
Features-wise, the tool is simple enough, offering:
- Ability to add & access snippets stored in .txt file
- View stored snippets in quicklist
- Click snippets to copy them to clipboard
- Option to add current clipboard item to .txt file
While its not a “live” clipboard manager it only lists items you specifically add; it does not present a history of your most recent clipboard items it is still a handy little tool.
### How to Install Snippets for Unity ###
To make use of this nifty Snippets launcher item youll need to first install the command-line clipboard tool xclip. Hit the button below to get it from the Software Center.
- [Click to Install XClip in Ubuntu][1]
Next up, download the following Snippets archive. This contains everything else needed to use the app.
- [Download Snippets Unity Launcher Script][2]
When the archive has downloaded fully youll want to extract it. Enter the resulting folder and hit Ctrl+H to reveal hidden files. Move the folder .snippets-launcher to your Home folder. **The utility wont work if this step isnt followed**.
Next step is to install the launcher item. This is taken care of by a script inside the folder you just moved, but it doesnt have executable permissions (needed to install it) so well need to first take care of that, too.
Open a new Terminal window and enter the following commands carefully:
cd .snippets-launcher/ && chmod +x snippets.sh
./snippets.sh
Thats it; Snippets should now be ready to use. Open the Unity Dash to search for the Snippets item and drag it onto the launcher.
- Left click on the launcher item opens the text file where you add your snippets
- Right click on the launcher item opens the quick list
Options in the quicklist:
- Left click on a snippet to add it to the clipboard
- Left click Date to copy the current date
- Click Add Clipboard Content to add current item to .txt file
- After adding items to .txt file click Update Launcher
For more information on the lazy-making tool, [head over to the Ubuntu Forums thread][3] where its developer, “Stinkeye”, will be happy to help.
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2013/10/unity-launcher-clipboard-snippets-item
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:apt://xclip
[2]:https://www.dropbox.com/s/ha6lngizmz78srv/snippets%20by%20stinkeye.tar.gz
[3]:http://ubuntuforums.org/showthread.php?t=2184916