mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
Merge branch 'master' of github.com:LCTT/TranslateProject
This commit is contained in:
commit
ea2a227ed3
@ -1,215 +0,0 @@
|
||||
10 basic examples of Linux ps command
|
||||
================================================================================
|
||||
### Linux ps command ###
|
||||
|
||||
The ps command on linux is one of the most basic commands for viewing the processes running on the system. It provides a snapshot of the current processes along with detailed information like user id, cpu usage, memory usage, command name etc. It does not display data in real time like top or htop commands. But even though being simpler in features and output it is still an essential process management/monitoring tool that every linux newbie should know about and learn well.
|
||||
|
||||
In this post we are going to revise the basics of using the ps command to check the processes and filter and sort them in different ways to suit better.
|
||||
|
||||
### Note on syntax ###
|
||||
|
||||
The ps command comes with an unusual set of 2 syntax styles. That is BSD and UNIX both. New users are often confused with and mis-interpret the two styles. So here is some basic info to get it clear before moving on.
|
||||
|
||||
> Note : "ps aux" is not the same as "ps -aux". For example "-u" is used to show process of that user. But "u" means show detailed information.
|
||||
|
||||
BSD style - The options in bsd style syntax are not preceded with a dash.
|
||||
|
||||
ps aux
|
||||
|
||||
UNIX/LINUX style - The options in linux style syntax are preceded by a dash as usual.
|
||||
|
||||
ps -ef
|
||||
|
||||
It is okay to mix both the syntax styles on linux systems. For example "ps ax -f".
|
||||
But in this post we shall mostly focus on the unix style syntax.
|
||||
|
||||
### How to use ps command ###
|
||||
|
||||
#### 1. Display all processes ####
|
||||
|
||||
The following command will give a full list of processes
|
||||
|
||||
$ ps ax
|
||||
$ ps -ef
|
||||
|
||||
Pipe the output to "less" to make it scrollable.
|
||||
|
||||
Use the "u" option or "-f" option to display detailed information about the processes
|
||||
|
||||
$ ps aux
|
||||
$ ps -ef -f
|
||||
|
||||
> Why is the USER column not displaying my username, but showing others like root, www-data etc ?
|
||||
|
||||
For all usernames (including yours) if the length is greater than 8 characters then ps will fall back to show only the UID instead of username.
|
||||
|
||||
#### 2. Display process by user ####
|
||||
|
||||
To filter the processes by the owning user use the "-u" option followed by the username. Multiple usernames can be provided separated by a comma.
|
||||
|
||||
$ ps -f -u www-data
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
www-data 1329 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1330 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1332 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1377 1372 0 09:32 ? 00:00:00 php-fpm: pool a.localhost
|
||||
www-data 1378 1372 0 09:32 ? 00:00:00 php-fpm: pool a.localhost
|
||||
www-data 4524 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4527 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4528 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
|
||||
#### 3. Show process by name or process id ####
|
||||
|
||||
To search the processes by their name or command use the "-C" option followed by the search term.
|
||||
|
||||
$ ps -C apache2
|
||||
PID TTY TIME CMD
|
||||
2359 ? 00:00:00 apache2
|
||||
4524 ? 00:00:00 apache2
|
||||
4525 ? 00:00:00 apache2
|
||||
...
|
||||
|
||||
To display processes by process id, use the "-p" option and provides the process ids separated by comma.
|
||||
|
||||
$ ps -f -p 3150,7298,6544
|
||||
|
||||
The "-C" must be provided with the exact process name and it cannot actually search with a partial name or wildcard. To search the process list more flexibly, the usual grep command has to be used
|
||||
|
||||
$ ps -ef | grep apache
|
||||
|
||||
#### 4. Sort process by cpu or memory usage ####
|
||||
|
||||
System administrators often want to find out processes that are consuming lots of memory or CPU. The sort option will sort the process list based on a particular field or parameter.
|
||||
|
||||
Multiple fields can be specified with the "--sort" option separated by a comma. Additionally the fields can be prefixed with a "-" or "+" symbol indicating descending or ascending sort respectively. There are lots of parameters on which the process list can be sorted. Check the man page for the complete list.
|
||||
|
||||
$ ps aux --sort=-pcpu,+pmem
|
||||
|
||||
Display the top 5 processes consuming most of the cpu.
|
||||
|
||||
$ ps aux --sort=-pcpu | head -5
|
||||
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
|
||||
root 1 2.6 0.7 51396 7644 ? Ss 02:02 0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
|
||||
root 1249 2.6 3.0 355800 30896 tty1 Rsl+ 02:02 0:02 /usr/bin/X -background none :0 vt01 -nolisten tcp
|
||||
root 508 2.4 1.6 248488 16776 ? Ss 02:02 0:03 /usr/bin/python /usr/sbin/firewalld --nofork
|
||||
silver 1525 2.1 2.3 448568 24392 ? S 02:03 0:01 /usr/bin/python /usr/share/system-config-printer/applet.py
|
||||
|
||||
#### 5. Display process hierarchy in a tree style ####
|
||||
|
||||
Many processes are actually forked out of some parent process, and knowing this parent child relationship is often helpful. The '--forest' option will construct an ascii art style tree view of the process hierarchy.
|
||||
|
||||
The following command will search for processes by the name apache2 and construct a tree and display detailed information.
|
||||
|
||||
$ ps -f --forest -C apache2
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
root 2359 1 0 09:32 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4524 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4525 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4526 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4527 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4528 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
|
||||
> Try not to use any sorting with the tree style display, as they both effect the order of display in different ways.
|
||||
|
||||
#### 6. Display child processes of a parent process ####
|
||||
|
||||
Here is an example of finding all forked apache processes.
|
||||
|
||||
$ ps -o pid,uname,comm -C apache2
|
||||
PID USER COMMAND
|
||||
2359 root apache2
|
||||
4524 www-data apache2
|
||||
4525 www-data apache2
|
||||
4526 www-data apache2
|
||||
4527 www-data apache2
|
||||
4528 www-data apache2
|
||||
[term]
|
||||
|
||||
The first process that is owned by root is the main apache2 process and all other apache2 processes have been forked out of this main process. The next command lists all child apache2 processes using the pid of the main apache2 process
|
||||
|
||||
[term]
|
||||
$ ps --ppid 2359
|
||||
PID TTY TIME CMD
|
||||
4524 ? 00:00:00 apache2
|
||||
4525 ? 00:00:00 apache2
|
||||
4526 ? 00:00:00 apache2
|
||||
4527 ? 00:00:00 apache2
|
||||
4528 ? 00:00:00 apache2
|
||||
|
||||
#### 7. Display threads of a process ####
|
||||
|
||||
The "-L" option will display the threads along with the processes. It can be used to display all threads of a particular process or all processes.
|
||||
|
||||
The following command shall display all the threads owned by the process with id 3150.
|
||||
|
||||
$ ps -p 3150 -L
|
||||
|
||||
#### 8. Change the columns to display ####
|
||||
|
||||
The ps command can be configured to show a selected list of columns only. There are a large number of columns to to show and the full list is available in the man pages.
|
||||
|
||||
The following command shows only the pid, username, cpu, memory and command columns.
|
||||
|
||||
$ ps -e -o pid,uname,pcpu,pmem,comm
|
||||
|
||||
It is possible to rename the column labels
|
||||
|
||||
$ ps -e -o pid,uname=USERNAME,pcpu=CPU_USAGE,pmem,comm
|
||||
PID USERNAME CPU_USAGE %MEM COMMAND
|
||||
1 root 0.0 0.0 init
|
||||
2 root 0.0 0.0 kthreadd
|
||||
3 root 0.0 0.0 ksoftirqd/0
|
||||
4 root 0.0 0.0 kworker/0:0
|
||||
5 root 0.0 0.0 kworker/0:0H
|
||||
7 root 0.0 0.0 migration/0
|
||||
8 root 0.0 0.0 rcu_bh
|
||||
9 root 0.0 0.0 rcuob/0
|
||||
10 root 0.0 0.0 rcuob/1
|
||||
|
||||
Quite flexible.
|
||||
|
||||
#### 9. Display elapsed time of processes ####
|
||||
|
||||
The elapsed time indicates, how long the process has been running for. The column for elapsed time is not shown by default, and has to be brought in using the "-o" option
|
||||
|
||||
$ ps -e -o pid,comm,etime
|
||||
|
||||
#### 10. Turn ps into an realtime process viewer ####
|
||||
|
||||
As usual, the watch command can be used to turn ps into a realtime process reporter. Simple example is like this
|
||||
|
||||
$ watch -n 1 'ps -e -o pid,uname,cmd,pmem,pcpu --sort=-pmem,-pcpu | head -15'
|
||||
|
||||
The output on my desktop is something like this.
|
||||
|
||||
Every 1.0s: ps -e -o pid,uname,cmd,pmem,pcpu --... Sun Dec 1 18:16:08 2013
|
||||
|
||||
PID USER CMD %MEM %CPU
|
||||
3800 1000 /opt/google/chrome/chrome - 4.6 1.4
|
||||
7492 1000 /opt/google/chrome/chrome - 2.7 1.4
|
||||
3150 1000 /opt/google/chrome/chrome 2.7 2.5
|
||||
3824 1000 /opt/google/chrome/chrome - 2.6 0.6
|
||||
3936 1000 /opt/google/chrome/chrome - 2.4 1.6
|
||||
2936 1000 /usr/bin/plasma-desktop 2.3 0.2
|
||||
9666 1000 /opt/google/chrome/chrome - 2.1 0.8
|
||||
3842 1000 /opt/google/chrome/chrome - 2.1 0.8
|
||||
4739 1000 /opt/google/chrome/chrome - 1.8 1.0
|
||||
3930 1000 /opt/google/chrome/chrome - 1.7 1.0
|
||||
3911 1000 /opt/google/chrome/chrome - 1.6 0.6
|
||||
3645 1000 /opt/google/chrome/chrome - 1.5 0.4
|
||||
3677 1000 /opt/google/chrome/chrome - 1.5 0.4
|
||||
3639 1000 /opt/google/chrome/chrome - 1.4 0.4
|
||||
|
||||
The output would be updated every 1 second to refresh the stats. However do not think that this is similar to top.
|
||||
|
||||
You would notice that the output of top/htop command changes much more frequently compared to the above ps command.
|
||||
|
||||
This is because the top output sorts on a value that is a mix of cpu usage and memory usage. But the above ps command sorts in a more simpler manner, taking 1 column at a time (like school maths). So it would not update rapidly like top.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.binarytides.com/linux-ps-command/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
@ -1,3 +1,5 @@
|
||||
翻译中 by小眼儿
|
||||
|
||||
How to Crack a Wi-Fi Network's WPA Password with Reaver
|
||||
================================================================================
|
||||

|
||||
@ -151,4 +153,4 @@ via: http://lifehacker.com/5873407/how-to-crack-a-wi+fi-networks-wpa-password-wi
|
||||
[14]:http://lifehacker.com/5756233/get-more-out-of-your-dd+wrt-router-with-an-external-drive?tag=ddwrt
|
||||
[15]:http://lifehacker.com/5680670/turn-your-dd+wrt-enabled-router-into-a-whole-house-ad-blocker?tag=ddwrt
|
||||
[16]:http://lifehacker.com/5563196/turn-your-old-router-into-a-range+boosting-wi+fi-repeater?tag=ddwrt
|
||||
[17]:http://lifehacker.com/178132/hack-attack-turn-your-60-router-into-a-600-router
|
||||
[17]:http://lifehacker.com/178132/hack-attack-turn-your-60-router-into-a-600-router
|
||||
|
39
sources/How to Install Linux Kernel 3.12 in Ubuntu 13.10.md
Normal file
39
sources/How to Install Linux Kernel 3.12 in Ubuntu 13.10.md
Normal file
@ -0,0 +1,39 @@
|
||||
How to Install Linux Kernel 3.12 in Ubuntu 13.10
|
||||
================================================================================
|
||||
Ubuntu 13.10 users don't have to look with envy at the new Linux kernels that are released, and they can update their systems with relative ease.
|
||||
|
||||
Canonical is usually sticking with one Linux kernel for an entire development cycle. For example, Ubuntu 13.10 is based on Linux kernel 3.11, but now a new stable Linux kernel, 3.12, has been launched.
|
||||
|
||||
Ubuntu users will have to wait until the release of the 14.04 LTS to get a newer Linux kernel, but they can also install, until then, new versions.
|
||||
|
||||
We have to warn you from the get-go. Canonical does not recommend updating your Linux kernel to other versions than the ones provided on official channels. This is not a totally safe procedure and you might have problems afterwards, even system failures. On the other hand, you might get better performance from your system.
|
||||
|
||||
The kernel you are about to download is from Canonical, which means that it is already in a .deb format. You won't have to compile it yourself. Open a terminal, navigate to the Downloads folder, and enter the following commands:
|
||||
|
||||
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12-saucy/linux-image-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
|
||||
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12-saucy/linux-headers-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
|
||||
You can also download the 32-bit version, if you have a 32-bit operating system. Just replace the 64-bit links with the ones for 32-bit, which can be found [here][1].
|
||||
|
||||
Now you will have to run those .deb, just like any other program. In the same terminal that you used to download the packages, write the following commands (you will need root access to make this work):
|
||||
|
||||
sudo dpkg -i linux-image-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
sudo dpkg -i linux-headers-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
|
||||
After the process is finished, you will have to restart the system and voila, the new Linux kernels are in place. The good news is that the old ones are still there and, if you need to delete 3.12, all you have to do is use a very well-known command.
|
||||
|
||||
sudo apt-get purge linux-image-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
sudo apt-get linux-headers-3.12.0-031200-generic_3.12.0-031200.201311031935_amd64.deb
|
||||
|
||||
One thing you have to remember. The names of the files shown above will change pretty soon. If the downloads are not working, you will have to update the new links. Enjoy Linux kernel 3.12!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://news.softpedia.com/news/How-to-Install-Linux-Kerrnel-3-12-in-Ubuntu-13-10-397013.shtml
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12-saucy/
|
46
sources/How to Repack Deb Files on Debian and Ubuntu.md
Normal file
46
sources/How to Repack Deb Files on Debian and Ubuntu.md
Normal file
@ -0,0 +1,46 @@
|
||||
How to Repack Deb Files on Debian and Ubuntu
|
||||
================================================================================
|
||||
**The following tutorial will teach Ubuntu, Linux Mint and Debian GNU/Linux users how to easily unpack and repack a .deb file on their Debian-based Linux operating system.**
|
||||
|
||||

|
||||
|
||||
Once in a while you reach a moment in life when, among other things, you want to modify a .deb file, to change something in it and repackage it back. But, only if you are truly into computing and hacking.
|
||||
|
||||
The following example is a true story, as it happen to me a while ago. A Linux developer created a Debian package (.deb) for a software, which I’ve install on my Ubuntu powered computer with success.
|
||||
|
||||
Apparently, the software did not worked correctly, as it was always stuck when it tried to retrieve some files from a Git repository. So, I knew where the files where installed (in the /opt directory), I’ve searched the code, found the issue and repair it in place. After that, the program was no longer stuck when it tried to retrieve the packages it needed.
|
||||
|
||||
So, long story short, I wanted to unpack the .deb file, replace the file I’ve patched in it, and repackage it back so I can install it on other computers or give it to my friends. How do I do that?
|
||||
|
||||
After searching the Internet for an answer to my problem, I’ve found a small blog called [ailoo.net][1] where it was explained like this:
|
||||
|
||||
mkdir -p extract/DEBIAN
|
||||
dpkg-deb -x package.deb extract/
|
||||
dpkg-deb -e package.deb extract/DEBIAN [...do something, e.g. edit the control file...]
|
||||
mkdir build
|
||||
dpkg-deb -b extract/ build/
|
||||
|
||||
These five commands will do the job like a charm. Let me explain them to you: the first one creates a folder called “extract” and a subfolder called “DEBIAN”; the second command will extract some files from your .deb package in the “extract” folder; the third command will extract the content of the .deb package in the “DEBIAN” subfolder, where you can modify/patch the files you want; the fourth command will create a folder called “build”; and the fifth command will repack the modified files into a new .deb package, which will be generated in the “build” folder.
|
||||
|
||||
That’s it! Just remember to stick with the commands above, and modify the files visually with a graphical text editor via your default file manager, after you’ve executed the third command. Do not hesitate to comment below if you run into problems during this tutorial.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://news.softpedia.com/news/How-to-Repack-Deb-Files-on-Debian-and-Ubuntu-404930.shtml
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://ailoo.net/2009/06/repack-a-deb-archive-with-dpkg-deb/
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
@ -0,0 +1,29 @@
|
||||
Linux Is the Only Way to Protect Against Potential Sound-Transmitted Malware
|
||||
================================================================================
|
||||
**A new type of malware that is using sound to transmit itself has been developed by scientists and it seems that the Linux systems are the only ones that can be protected against this kind of attacks.**
|
||||
|
||||
Scientists Michael Hanspach and Michael Goetz from Fraunhofer FKIE, Wachtberg, Germany, have developed a technique capable of infecting other computers with malware that transmits itself using just speakers and microphones.
|
||||
|
||||
“Covert channels can be used to circumvent system and network policies by establishing communications that have not been considered in the design of the computing system. We construct a covert channel between different computing systems that utilizes audio modulation/demodulation to exchange data between the computing systems over the air medium,” [reads the paper][1] that they published in the Journal of Communications.
|
||||
|
||||
This would prove a very powerful method of infecting computers, especially because they don't even have to be linked in a network. All that is needed for the method to work is proximity.
|
||||
|
||||
Another problem is that there is virtually no protection embedded in today's operating systems for such malware. The good news is that Linux users can make a few small modifications in order to gain that much needed protection.
|
||||
|
||||
The developers have explained that Linux systems can be programed, rather easily, to adapt to this new form of attacks.
|
||||
|
||||
“If audio input and output devices cannot be switched off, implementation of audio filtering options may be an alternative approach to counter maliciously triggered participation in covert networks. “
|
||||
|
||||
“In Linux-based operating systems, a software-defined audio filter can be implemented with ALSA (Advanced Linux Sound Architecture) in conjunction with the LADSPA (Linux Audio Developer’s Simple Plugin API),” the scientists say in the paper.
|
||||
|
||||
Sound-transmitted malware is something very new and it's no wonder that there is no protection against it, but it goes to show why Linux systems are considered safer.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://news.softpedia.com/news/Linux-Is-the-Only-Way-to-Protect-Against-Possible-Malware-Through-Sound-Attacks-405566.shtml
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.jocm.us/index.php?m=content&c=index&a=show&catid=124&id=600
|
61
sources/Open Source Is Here To Stay On IBM i.md
Normal file
61
sources/Open Source Is Here To Stay On IBM i.md
Normal file
@ -0,0 +1,61 @@
|
||||
Open Source Is Here To Stay On IBM i
|
||||
================================================================================
|
||||
For years, open source software has been a bit of a redheaded stepchild in the button-down IBM midrange community. IBM i shops were hesitant to use it, and vendors were afraid to adopt it. But with so much of the computing world now running on open source, the aversion to open source has gradually melted away, and it has steadily crept into use among large corporations, and the IBM i world too.
|
||||
|
||||
It is tough to measure the adoption of open source software, which flows freely across networks by its very nature. Nobody requires you to register to use open source software, and there's no central clearinghouse of information about open source software.
|
||||
|
||||
However, recent surveys and audits point to greater adoption of open source across all industries. Open source software components are widely used in in the financial services industry, according to Julian Brook, associate director at SQS Software, which conducts software quality audits for financial software vendors. "I would say that, arguably, open source is used in every organization that is developing software, especially in the financial services world," Brook [told Out-Law.com recently][1].
|
||||
|
||||
Governmental agencies lead the way in use of open source software, according to [Black Duck Software][2]'s 2013 Future of Open Source survey. More than 35 percent of government representatives queried for the survey say they use open source, followed by medical (15.2 percent), media (13 percent), financial (8.8 percent), and retail (5.9 percent). You can view more of the survey at [Slideshare][3].
|
||||
|
||||
Increasingly, users are adopting open source software because they expect higher software quality and security with open source, according to surveys like those from Black Duck. That's very interesting, because for many years, open source software was largely avoided for those two very reasons.
|
||||
|
||||
These are opinion surveys, mind you. They're not necessarily reflections of actual reality. But it is clear than many of the shortcomings that people previously associated with open source software products are disappearing. And slowly but surely, this trend is bleeding over into the competitive world of IBM i software, too.
|
||||
|
||||
### Open Source Impacts On IBM i ###
|
||||
|
||||
The IBM i server is one of the last great bastions of proprietary technology in a world heading in the direction of open source. IBM does not share with the world the guts of the IBM i OS and the System Licensed Internal Code (SLIC) it runs on. You can take what access IBM provides developers to the machine, or you can leave it, but you can't get access to the internals.
|
||||
|
||||
What goes on above the OS and SLIC layers is another matter entirely. We're not seeing a big influx of open source software in the world of ERP and business applications. But in many other software categories, open source options are proliferating.
|
||||
|
||||
One IBM i proponent of open source software is [Raz-Lee][4]. The security software vendor, which relies on the open source [ClamAV][5] offering to power its IBM i-based anti-virus offering, called iSecurity Anti-Virus, says ClamAV had an update for an evolving security threat--the W32/Autorun.worm.aaeh Trojan Horse--months before its competitor had updated the signature library for its IBM i-based antivirus offering.
|
||||
|
||||
"It turns out that ClamAV has been handling this threat . . . as of about eight to nine months ago," Raz-Lee vice president of business development Eli Spitz wrote in an email to IT Jungle last month. "In fact, one of our technicians here at Raz-Lee actually added his own unofficial signature to ClamAV's database before ClamAV included their formal signature for this virus."
|
||||
|
||||
Another IBM i software vendor using open source tools is [Arpeggio Software][6] . The Atlanta, Georgia-based company uses lots of open source components in its various IBM i utilities, which aren't available under an open source license, but which Arpeggio gives away and then charges customers to get technical support, a common approach taken by commercial open source vendors.
|
||||
|
||||
Arpeggio's latest offering, called ARP-DROP, uses the open source OAuth authentication method to help secure communication channels between IBM i servers and [DropBox][7] service running on the Internet. It also uses the OpenSSH encryption technology with ARP-SFTP client for IBM i. Arpeggio's founders (who also founded Trailblazer Systems, now part of [Liaison Technologies][8]) acknowledge that IBM i professionals could adopt the same open source tools to write similar tools. But they argue that Arpeggio does it better, so why not adopt their free tools and save yourself the time?
|
||||
|
||||
In many cases, an IBM i shop's first conscious exposure to open source is the server side scripting language PHP. IBM and [Zend Technology][9] have worked for years to make PHP run well on IBM i, and Zend's entry-level PHP runtime is shipped along with every Power Systems server and IBM i license.
|
||||
|
||||
One of the most popular PHP applications that run on IBM i servers is [SugarCRM][10]. Representatives with the Cupertino, California, company recently said that it has nearly 1,000 customers running the CRM software on IBM i servers. This includes paid enterprise licenses along with free community edition licenses.
|
||||
|
||||
### Fighting Perceptions ###
|
||||
|
||||
Most IBM i shops are big users of IBM i software, whether they know it or not. Some of the biggest, most important IT infrastructure components come from open source, including the Apache Web server, the Linux OS, the Java and PHP programming languages, the MySQL database, and the Eclipse development environment.
|
||||
|
||||
There's no reason not to call open source "commercial grade" anymore, Raz-Lee's Spitz said. "A few weeks ago Sourcefire, the owners of ClamAV, was purchased by [Cisco Systems][11]. That's obviously a 'certification' by a large commercial organization for open source software. So open source anti-virus software seems to be valuable to a multi-national company."
|
||||
|
||||
While open source software is making inroads in the IBM i community, it still has a ways to go to match the momentum that open source enjoys in the IT market as a whole. "It seems that the IBM i community is often less involved with open source and is not exposed to its importance and prevalence in the current computing area," Spitz said. "In many cases, open source is the 'playground' of very large companies who join to create a better arena for us all."
|
||||
|
||||
As the corporations of the world gradually becomes amenable to open source, the IBM i community will have no choice but to follow.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.itjungle.com/tfh/tfh120213-story01.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.out-law.com/en/articles/2013/september/open-source-code-use-within-financial-services-organisations-visibility-only-50-at-best-says-software-quality-expert/
|
||||
[2]:http://www.blackducksoftware.com/
|
||||
[3]:http://www.slideshare.net/blackducksoftware/the-2013-future-of-open-source-survey-results
|
||||
[4]:http://www.razlee.com/
|
||||
[5]:http://www.clamav.net/
|
||||
[6]:http://www.arpeggiosoftware.com/
|
||||
[7]:http://www.dropbox.com/
|
||||
[8]:http://www.liaison.com/
|
||||
[9]:http://www.zend.com/
|
||||
[10]:http://www.sugarcrm.com/
|
||||
[11]:http://www.cisco.com/
|
216
translated/10 basic examples of Linux ps command.md
Executable file
216
translated/10 basic examples of Linux ps command.md
Executable file
@ -0,0 +1,216 @@
|
||||
ps命令的10个例子
|
||||
================================================================================
|
||||
### Linux ps 命令 ###
|
||||
|
||||
linux的ps命令是一个浏览系统运行的进程的一个最基础的工具。它提供了一个当前进程的快照,还带有一些具体的信息,比如用户id,cpu使用率,内存使用,命令名等它不会像top或者htop一样实时显示数据。即使他在功能和输出上更见但,但是它仍是一个每个linux新人需要了解和学习的一个必要的进程管理/检测工具。
|
||||
|
||||
在本篇中,我门会复习ps命令基本的用法:检测、过滤、以不同的方式排序进程来更好地适应。
|
||||
|
||||
### 语法说明 ###
|
||||
|
||||
ps命令有两种不同风格的语法规则。它们是BSD和UNIX。新人经常感到困惑并会误解这两种风格。因此在继续本篇之前有一些基本的信息要澄清。
|
||||
|
||||
> 注意: "ps aux"不等同于"ps -aux"。比如"-u"用于显示用户的进程,但是"u"意味着显示具体信息。
|
||||
|
||||
BSD 形式 - BSD形式的语法的选项前没有破折号。
|
||||
|
||||
ps aux
|
||||
|
||||
UNIX/LINUX 形式 - linux形式的语法的选项前有破折号。
|
||||
|
||||
ps -ef
|
||||
|
||||
在linux系统上混合这两种语法是可以的。比如 "ps ax -f"。但是本章中我们主要讨论unix形式语法。
|
||||
|
||||
### 如何使用ps命令 ###
|
||||
|
||||
#### 1. 显示所有进程 ####
|
||||
|
||||
下面的命令可以显示所有进程的列表。
|
||||
|
||||
$ ps ax
|
||||
$ ps -ef
|
||||
|
||||
通过管道输出到"less"可以使它滚动。
|
||||
|
||||
使用"u"或者"-f"选项可以显示进程的具体信息。
|
||||
|
||||
$ ps aux
|
||||
$ ps -ef -f
|
||||
|
||||
> 为什么USER列显示的不是我的用户名而是其他的像root,www-data等等?
|
||||
|
||||
对于所有的用户(包括你们的),如果长度大于8个字符,那么ps只会显示你的UID而不是用户名。
|
||||
|
||||
#### 2. 显示用户进程 ####
|
||||
|
||||
使用"-u"选项后跟用户名来过滤所属用户的进程。多个用户名可以用逗号分隔。
|
||||
|
||||
$ ps -f -u www-data
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
www-data 1329 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1330 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1332 1328 0 09:32 ? 00:00:00 nginx: worker process
|
||||
www-data 1377 1372 0 09:32 ? 00:00:00 php-fpm: pool a.localhost
|
||||
www-data 1378 1372 0 09:32 ? 00:00:00 php-fpm: pool a.localhost
|
||||
www-data 4524 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4527 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4528 2359 0 10:03 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
|
||||
#### 3. 通过名字或者进程id显示进程 ####
|
||||
|
||||
通过"-C"选项后面加上名字或者命令来搜索进程。
|
||||
|
||||
$ ps -C apache2
|
||||
PID TTY TIME CMD
|
||||
2359 ? 00:00:00 apache2
|
||||
4524 ? 00:00:00 apache2
|
||||
4525 ? 00:00:00 apache2
|
||||
...
|
||||
|
||||
要通过进程id显示进程,就使用"-p"选项,并且它还提供使用逗号来分割进程id。
|
||||
|
||||
$ ps -f -p 3150,7298,6544
|
||||
|
||||
"-C"必须提供精确的进程名,并且它并不能通过部分名字或者通配符查找。为了更弹性地搜索进程列表,通常使用grep命令。
|
||||
|
||||
$ ps -ef | grep apache
|
||||
|
||||
#### 4. 通过cpu或者内存使用排序进程 ####
|
||||
|
||||
系统管理员通常想要找出那些消耗最多内存或者CPU的进程。排序选项会基于特性的字段或者参数排序进程列表。
|
||||
|
||||
多个字段可以用'--sort'指定,并用逗号分割。除此之外,字段前面还可以跟上'-'或者'+'的前缀来相应地表示递减和递增排序。这里有很多的用于排序的选项。通过man页来获取完整的列表。
|
||||
|
||||
|
||||
$ ps aux --sort=-pcpu,+pmem
|
||||
|
||||
显示前5名最耗cpu的进程。
|
||||
|
||||
$ ps aux --sort=-pcpu | head -5
|
||||
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
|
||||
root 1 2.6 0.7 51396 7644 ? Ss 02:02 0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
|
||||
root 1249 2.6 3.0 355800 30896 tty1 Rsl+ 02:02 0:02 /usr/bin/X -background none :0 vt01 -nolisten tcp
|
||||
root 508 2.4 1.6 248488 16776 ? Ss 02:02 0:03 /usr/bin/python /usr/sbin/firewalld --nofork
|
||||
silver 1525 2.1 2.3 448568 24392 ? S 02:03 0:01 /usr/bin/python /usr/share/system-config-printer/applet.py
|
||||
|
||||
#### 5. 以树的形式显示进程层级 ####
|
||||
|
||||
许多进程实际上是从同一个父进程fork出来的,并且了解父子关系通常是很有用的。"--forest" 选项会构造一个ascii艺术形式的进程层级视图。
|
||||
|
||||
下面的命令会用apache2的进程名来搜索并构造一个树来显示具体信息。
|
||||
|
||||
$ ps -f --forest -C apache2
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
root 2359 1 0 09:32 ? 00:00:00 /usr/sbin/apache2 -k start
|
||||
www-data 4524 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4525 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4526 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4527 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
www-data 4528 2359 0 10:03 ? 00:00:00 \_ /usr/sbin/apache2 -k start
|
||||
|
||||
> 尽量不要在排序中使用树状显示,因为两者都会以不同方式影响显示的顺序。
|
||||
|
||||
#### 6. 显示父进程的子进程 ####
|
||||
|
||||
下面一个是找出所有从apache进程fork出来的进程的例子。
|
||||
|
||||
$ ps -o pid,uname,comm -C apache2
|
||||
PID USER COMMAND
|
||||
2359 root apache2
|
||||
4524 www-data apache2
|
||||
4525 www-data apache2
|
||||
4526 www-data apache2
|
||||
4527 www-data apache2
|
||||
4528 www-data apache2
|
||||
[term]
|
||||
|
||||
第一个属于root的进程是apache2的主进程,其他的apache进程都是从主进程fork出来的。下面的命令使用apache2主进程的pid列出了所有的apache2的子进程。
|
||||
|
||||
[term]
|
||||
$ ps --ppid 2359
|
||||
PID TTY TIME CMD
|
||||
4524 ? 00:00:00 apache2
|
||||
4525 ? 00:00:00 apache2
|
||||
4526 ? 00:00:00 apache2
|
||||
4527 ? 00:00:00 apache2
|
||||
4528 ? 00:00:00 apache2
|
||||
|
||||
#### 7. 显示进程的线程 ####
|
||||
|
||||
"-L"选项会随着进程一起显示线程。它可用于显示所有特定进程或者所有进程的线程。
|
||||
|
||||
下面的命令会显示进程id为3150的进程的所有线程。
|
||||
|
||||
$ ps -p 3150 -L
|
||||
|
||||
#### 8. 改变显示的列 ####
|
||||
|
||||
ps命令可以被配置用来只显示被选中的列。很多列可以被用来显示,并且完整的列表在man页中。
|
||||
|
||||
下面的命令会只显示pid、用户名、cpu、内存、命令列。
|
||||
|
||||
$ ps -e -o pid,uname,pcpu,pmem,comm
|
||||
|
||||
同样可以重命名列的名字。
|
||||
|
||||
$ ps -e -o pid,uname=USERNAME,pcpu=CPU_USAGE,pmem,comm
|
||||
PID USERNAME CPU_USAGE %MEM COMMAND
|
||||
1 root 0.0 0.0 init
|
||||
2 root 0.0 0.0 kthreadd
|
||||
3 root 0.0 0.0 ksoftirqd/0
|
||||
4 root 0.0 0.0 kworker/0:0
|
||||
5 root 0.0 0.0 kworker/0:0H
|
||||
7 root 0.0 0.0 migration/0
|
||||
8 root 0.0 0.0 rcu_bh
|
||||
9 root 0.0 0.0 rcuob/0
|
||||
10 root 0.0 0.0 rcuob/1
|
||||
|
||||
非常弹性化。
|
||||
|
||||
#### 9. 显示进程运行的时间 ####
|
||||
|
||||
运行的时间指的是,进程已经运行的时间。运行时间的列并没有默认显示,需要使用-o选项带入。
|
||||
|
||||
$ ps -e -o pid,comm,etime
|
||||
|
||||
#### 10. 将ps转换为实时进程查看器 ####
|
||||
|
||||
As usual, the watch command can be used to turn ps into a realtime process reporter. Simple example is like this
|
||||
通常上,watch命令可将ps命令变成实时进程查看器。像这个简单的命令
|
||||
|
||||
$ watch -n 1 'ps -e -o pid,uname,cmd,pmem,pcpu --sort=-pmem,-pcpu | head -15'
|
||||
|
||||
我桌面上的输出就像这样。
|
||||
|
||||
Every 1.0s: ps -e -o pid,uname,cmd,pmem,pcpu --... Sun Dec 1 18:16:08 2013
|
||||
|
||||
PID USER CMD %MEM %CPU
|
||||
3800 1000 /opt/google/chrome/chrome - 4.6 1.4
|
||||
7492 1000 /opt/google/chrome/chrome - 2.7 1.4
|
||||
3150 1000 /opt/google/chrome/chrome 2.7 2.5
|
||||
3824 1000 /opt/google/chrome/chrome - 2.6 0.6
|
||||
3936 1000 /opt/google/chrome/chrome - 2.4 1.6
|
||||
2936 1000 /usr/bin/plasma-desktop 2.3 0.2
|
||||
9666 1000 /opt/google/chrome/chrome - 2.1 0.8
|
||||
3842 1000 /opt/google/chrome/chrome - 2.1 0.8
|
||||
4739 1000 /opt/google/chrome/chrome - 1.8 1.0
|
||||
3930 1000 /opt/google/chrome/chrome - 1.7 1.0
|
||||
3911 1000 /opt/google/chrome/chrome - 1.6 0.6
|
||||
3645 1000 /opt/google/chrome/chrome - 1.5 0.4
|
||||
3677 1000 /opt/google/chrome/chrome - 1.5 0.4
|
||||
3639 1000 /opt/google/chrome/chrome - 1.4 0.4
|
||||
|
||||
输出会每秒刷新状态。但不要认为这和top相似。
|
||||
|
||||
你会发现top/htop命令的输出相比上面的ps命令刷新得更频繁。
|
||||
|
||||
这是因为top输出会cpu使用和内存使用值混合排序后的输出。但是上面的ps命令是一个更简单的行为的排序,每次获取一列(像学校的数学)。因此它不会像top那样快速更新。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.binarytides.com/linux-ps-command/
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
@ -1,14 +1,14 @@
|
||||
13 Linux Cat命令管理(显示,排序,建立)文件实例
|
||||
13个 Linux Cat命令管理(显示,排序,建立)文件实例
|
||||
================================================================================
|
||||

|
||||
|
||||
Linux系统中,许多配置文件,Logs文件,甚至shell脚本都使用文本文件格式,因此,Linux系统存在着多种文本编辑器,但当你仅仅想要查看一下它们里的内容时,可使用cat命令。
|
||||
在Linux系统中,大多数配置文件、Logs文件,甚至shell脚本都使用文本文件格式,因此,Linux系统存在着多种文本编辑器,但当你仅仅想要查看一下这些文件的内容时,可使用一个简单的命令-cat.
|
||||
|
||||
cat手册里这样描述:
|
||||
|
||||
> cat命令读取文件内容,并输出到标准设备上面
|
||||
|
||||
cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请跟随我来一起使用它.
|
||||
cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来,让我们开始学习如何使用.
|
||||
|
||||
### 1. 显示文件内容 ###
|
||||
|
||||
@ -19,9 +19,9 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
CentOS release 5.10 (Final)
|
||||
Kernel \r on an \m
|
||||
|
||||
### 2. 在行首显示行号 ###
|
||||
### 2. 在运行中显示行号 ###
|
||||
|
||||
当在读取内容很多的配置文件时,加上-n参数可实现在行首显示行号。
|
||||
当在读取内容很多的配置文件时,在运行中显示行号将会使操作变简单,加上-n参数可以实现.
|
||||
|
||||
|
||||
# cat -n /etc/ntp.conf
|
||||
@ -39,7 +39,7 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
|
||||
### 3. 在行首显示非空行号 ###
|
||||
|
||||
类似于-n参数,-b也在行首显示行号.但它显示的行号为非空行行号
|
||||
类似于-n参数,-b也在运行中显示行号.区别在于-b只显示非空行行号.
|
||||
|
||||
#cat -b /etc/ntp.conf
|
||||
|
||||
@ -89,7 +89,7 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
|
||||
### 7. 每页满屏显示 ###
|
||||
|
||||
当文件内容超过一屏显示范围时,可结合cat命令与其它命令满屏显示.使用管道符 ( | ).
|
||||
当文件内容显示不适合你的屏幕, 可结合cat命令与其它命令满屏显示.使用管道符 ( | ).
|
||||
|
||||
# cat /proc/meminfo | less
|
||||
|
||||
@ -100,8 +100,11 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
### 8. 同时查看2个文件中的内容 ###
|
||||
|
||||
位于/root文件夹里有两人文件取名linux及desktop,每个文件含有以下内容 :
|
||||
|
||||
**Linux** : ubuntu, centos, redhat, mint and slackware
|
||||
|
||||
**Desktop** : gnome kde, xfce, enlightment, and cinnamon
|
||||
|
||||
当你想同时查看两文件中的内容时,可按如下方法 :
|
||||
|
||||
# cat /root/linux /root/desktop
|
||||
@ -119,7 +122,7 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
|
||||
### 9. 排序显示 ###
|
||||
|
||||
类似. 你也可结合 **sort**管道符对内容进行排序显示. 举例 :
|
||||
类似. 你也可以结合cat命令与其它命令来进行自定义输出. 如结合 **sort**管道符对内容进行排序显示. 举例 :
|
||||
|
||||
# cat /root/linux | sort
|
||||
|
||||
@ -131,7 +134,7 @@ cat是一条linux内置命令. 几乎所有linux发行版都内置.接下来请
|
||||
|
||||
### 10. 输入重定向 ###
|
||||
|
||||
你也可将显示结果输出重定向到屏幕或另一个文件. 只需要使用 > 符号即可输出生成到另一个文件.
|
||||
你也可将显示结果输出重定向到屏幕或另一个文件. 只需要使用 > 符号(大于号)即可输出生成到另一个文件.
|
||||
|
||||
# cat /root/linux > /root/linuxdistro
|
||||
|
||||
@ -148,7 +151,7 @@ Linux下有多种方法新建文件. 其中使用cat就是方法之一.
|
||||
Windows
|
||||
MacOS
|
||||
|
||||
当你打入cat > operating_system,它会生成一个operating_system的文件. 然后下面会显示空行. 此时你可输入内容.比如我们输入Unix, Linux, Windows and MacOS. 输入完成后, **按Ctrl-D**存盘退出cat. 此时你会发现当前文件夹下会生成一个包含你刚才输入内容的叫 **operating_system**的文件.
|
||||
当你输入cat > operating_system,它会生成一个operating_system的文件. 然后下面会显示空行. 此时你可输入内容.比如我们输入Unix, Linux, Windows and MacOS. 输入完成后, **按Ctrl-D**存盘退出cat. 此时你会发现当前文件夹下会生成一个包含你刚才输入内容的叫 **operating_system**的文件.
|
||||
|
||||
### 12.向文件中追加内容 ###
|
||||
|
||||
@ -174,7 +177,7 @@ Linux下有多种方法新建文件. 其中使用cat就是方法之一.
|
||||
|
||||
### 13. 重定向输入 ###
|
||||
|
||||
你可使用 **<**命令将文件输入到cat中 .
|
||||
你可使用 **<**命令(小于号)将文件输入到cat中.
|
||||
|
||||
# cat < /root/linux
|
||||
|
||||
@ -206,6 +209,6 @@ Linux下有多种方法新建文件. 其中使用cat就是方法之一.
|
||||
|
||||
via: http://linoxide.com/linux-command/13-cat-command-examples/
|
||||
|
||||
译者:[hongchuntang](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[hongchuntang](https://github.com/译者ID) 校对:[Caroline](https://github.com/carolinewuyan)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
Loading…
Reference in New Issue
Block a user