Ten Powerful Linux Commands

Today is the last day in 2009, I have no idea what should I do but just want to pray that my family, relatives and bosom  friends would have a sweet life in the next year. Linux is a 2nd OS in my life, there are always something new can make me  feel awesome, so I think with continuous interests it brings to me I believe that I will do well in it though some  obstacles may often encountered when using it. Following article is digged from digg website that I think it's helpful and post it here hoping the author do not mind. The original article's link is http://laptoplogic.com/resources/ten-powerful -linux-commands

 

This article is equal parts opinion and fact, as the most powerful commands depends on what one needs them for; someone who  is running a network of Linux machines will require different commands than an individual user. With that said, without  regard to opinion, many commands are powerful, and any Linux user would do well to know them. Below are ten such commands,  all simple in nature but powerful in their usefulness. The method in which they are executed will depend on the Linux system  used. For example, you may need to use su instead of sudo or nothing at all, if you're running as root. Note: to see a full  list of possibilities for commands, type 'command - -help' in the Terminal.

 

1. PS
The PS command is a powerful command, and its power comes from its utter versatility. The PS command means 'process status',  and displays everything to do with processes; think of it as the task manager of geeks. There are many variations of PS that  can be used, such as the common PS AUX, which will pull a Terminal list of all running processes, or PS AUX | GREP PID to  pull up a specific process. Used in conjunction with the kill command allows users to end processes.

2. RM -RF
This command is, quite possibly, the most powerful command, as it can destroy entire systems in the wrong hands. The rm -rf  dir is used to remove (permanently delete) a directory, or multiple directories. For example, rm -rf dir / will delete the  home directory. This powerful command is perfect for removing an unneeded directory, but should be used with caution, and  only by individuals who understand what they are doing.

3. PSTREE
The pstree command is another variation of the PS command, and is quite useful for those who do frequent work on different  machines and servers. If you need to get a quick peek at the different programs that are running, and what processes stem  from other processes, PSTREE is more useful and organized than a general PS AUX command.

4. HISTORY
Let's say that a directory randomly disappears from a user's computer, and they insist that they weren't playing in the  Terminal and running commands that they shouldn't be. If you want to check up on a specific instance of a command being run,  you can issue the command history | grep -i command, replacing command with your search term. If you're just interested in  seeing a general history, you can just type history and get a list of all the activity that's been going on inside the  Terminal.

5. APROPOS
If knowledge is power, then apropos is a very powerful command, as it knows every command you can use for a specific item,  such as directories or files. If you're looking for a certain command to run on, say, directories, but you can't quite  remember what it's called, then running apropos dir will yield a list of possible commands. The same goes for files,  pictures, documents, and more.

6. LS
If you were to ask any Linux admin what command they use on a daily basis, the LS command will likely be the one. This  useful, yet simple, command allows users to view the contents of a directory and, in conjunction with a number of other  commands, to refine just what info you get. A good example is the LS -LH command; using this command within a directory will  display the size of files with easy to read formats versus the long series of numbers usually displayed. For example, 8000  will become 8MB.

7. GREP
If you're an astute reader you'll have noticed that we've shown many command examples that include grep; the frequency of  this is a sign of the command's usefulness. The GREP command is a filter of sorts. It is used to search for any instance of a  pattern that the user specifies and to output it to a neat list. So, for example, to filter through running processes for  specific apps, you can add | grep app to find it. Likewise, if you would like to find a certain phrase within a text file,  you could run a command like grep [aA] file.txt, which would return results for both small and capital 'A's'.

8. FIND
The FIND command is incredibly powerful, especially when used as root. This command can be used to find anything on the  system, as simple as that sounds, and anything within specific directories that you specify. For example, if you're in need  of tweaking a password file for whatever reason, instead of manually hunting down all the files, you can instead run sudo  find / -name passwd. This command will be run as root (replace sudo with whatever your distro uses), and find any file named  'passwd'. There are many different commands that can be used in conjunction with find, such as: -print, -perm, -type, etc.

9. CRON
Sadly, this nifty little command is not included in popular lists as often as it should be. This command is powerful in that  it can do things on your behalf when you're not around. Let's say that you're planning a weekend trip without a computer, and  you need to make sure that your files are backed up every day. Like a smart admin, you'd never let anyone else touch your  computer, let alone the Terminal. The solution? Use CRON. To do so, you simply set a time, then the command to be executed.

The pattern for setting time is as follows: minute | hour | day | month | week + command.

For 'minute', specify the minute you would like it to start like so: 15. If you would like a command to run every specific  set of minute intervals, add an asterisk after the minute command; to run a command over several different minute periods,  add a comma to separate them.

For example: 04, 07, 23, 45 * * * * /usr/bin/something -backup

The same applies for 'hour', 'day', 'month', and 'week'.

10. WGET
Some people scoff at this one. WGET is powerful? Why, yes, yes it is. You see, WGET can be used to download things at any  time, even if you're not there. It can be scheduled to run at midnight while you're safely tucked away in your bed, or to  download a necessary update while you're out on business. WGET is a command that is used to fetch something from online;  think of it as a download tool. There's a massive amount of commands that can be used in conjunction with WGET, all that  function to make your life easier. Here's an example:

WGET -M http://www.website.com/ . This command is used to mirror (aka, download) a website.


END :)  wcdj   2009-12-31

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值