mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
[Translated] 10 Lesser Known Effective Linux Commands – Part IV
This commit is contained in:
parent
d7e9518dbb
commit
961240e019
@ -1,10 +1,7 @@
|
||||
Translating-----------------geekpi
|
||||
|
||||
|
||||
|
||||
10 Lesser Known Effective Linux Commands – Part IV
|
||||
10个鲜为人知的Linux命令(4)
|
||||
================================================================================
|
||||
Continuing the **Lesser Known** series, this fourth article of the series will let you know some useful **funny** and **animated** commands. Here we go into the practical session, without much theory.
|
||||
继续我们的"鲜为人知"系列,本系列的第四篇会让你了解一些**有趣** 又 **动态**的命令。这里我们进入实际的教程,没有很多理论。
|
||||
|
||||
![](http://www.tecmint.com/wp-content/uploads/2013/11/10-Lesser-Known-Effective-Commands-.png)
|
||||
|
||||
@ -12,17 +9,17 @@ Continuing the **Lesser Known** series, this fourth article of the series will l
|
||||
- [10 Lesser Known Linux Commands – Part 2][2]
|
||||
- [10 Lesser Known Commands for Linux – Part 3][3]
|
||||
|
||||
In the fourth article of this series which includes few other lesser known Linux commands, worth knowing. Might be you’re already aware of these commands, no doubt you’re an experienced Linux user and loves exploration.
|
||||
本系列的第四篇包含了另外的鲜为人知的Linux命令,这些值得去了解。也许你已经知道了这些命令,毫无疑问你是一个有经验的Linux用户并且乐于探索。
|
||||
|
||||
### 32. strace Command ###
|
||||
|
||||
The **strace** is a debugging tool which is used primarily for troubleshooting purpose in Linux. It might not be installed by default in your system and you may need to **apt** or **yum** the required package.
|
||||
**strace**是一个调试工具并被主要用于Linux的故障排除。它可能在你的系统内没有默认安装,你可能需要**apt** 或者 **yum**安装所需要的包。
|
||||
|
||||
Trace a command execution using strace command:
|
||||
使用strace命令追踪一个命令的执行。
|
||||
|
||||
root@tecmint [~]# strace pwd
|
||||
|
||||
#### Sample Output ####
|
||||
#### 示例输出 ####
|
||||
|
||||
execve("/bin/pwd", ["pwd"], [/* 29 vars */]) = 0
|
||||
brk(0) = 0x728000
|
||||
@ -44,56 +41,56 @@ Trace a command execution using strace command:
|
||||
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29b0de6000
|
||||
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29b0de5000
|
||||
....
|
||||
**strace**命令接收大量的参数和选项,请参考man页来获取详细信息。
|
||||
|
||||
The **strace** command accepts a lot of arguments and have many options. Refer to man page for detailed information.
|
||||
### 33. disown -a && exit 命令 ###
|
||||
|
||||
### 33. disown -a && exit Command ###
|
||||
大多数系统管理员使用[screen 命令][4]来控制运行在终端后台的作业。让我们假设一下如果你有一个长期运行的作业并想要将它从终端中**分离**,你可以用screen命令来这么做。但是如果你不知道如何使用screen,那么disown可以用来救急。
|
||||
|
||||
Most of the system administrators use [screen command][4] to control jobs running in the terminal background. Let’s say if you having a long running job and want to **detach** from the terminal, you use screen command to do it. But what if you don’t know how to use screen, here comes disown command to rescue.
|
||||
disown命令可以在后台持续运行作业即使你关闭了终端会话。disown命令的语法是:
|
||||
|
||||
The disown command is used to run the jobs continuously in the background even after you closing the terminal session. The syntax of the disown command is:
|
||||
|
||||
root@tecmint [~]# Command; disown -a && exit
|
||||
|
||||
To detach again the long running job in the terminal, use the **jobs** command to find the job number and then use disown **%n** where **n** is the job number. To verify actually the job is running use **ps** or [top command][5]. The **nohup** command is an alternative to the disown command.
|
||||
为了在终端中再次分离长期运行的作业,使用**jobs**命令来找出作业号,接着使用disown **%n**,这里的**%n**是作业号。为了验证作业确实在运行,使用**ps** 或者 [top 命令][5]。**nohup**命令也是一个disown命令的替代品。
|
||||
|
||||
### 34. getconf LONG_BIT Command ###
|
||||
### 34. getconf LONG_BIT 命令 ###
|
||||
|
||||
The above command shows your machine architecture if it is **32** bit or **64** bit?
|
||||
上面的命令能显示你的机器架构是**32** bit 或者 **64** 位?
|
||||
|
||||
root@tecmint [~]# getconf LONG_BIT
|
||||
|
||||
32
|
||||
|
||||
- [Download Linux Command Line Cheat Sheet][5]
|
||||
- [下载Linux命令备忘单][5]
|
||||
|
||||
### 35. Display Date on the Terminal ###
|
||||
### 35. 终端上显示日期 ###
|
||||
|
||||
The below command is a combination of several commands, better say it a script. For a person working at shell or terminal, without GUI seeing current system date is tedious job. You have to type ‘**date**‘ command to check today’s date.
|
||||
下面的命令是几个命令的集合,确切地说是一个脚本。对于在shell或者终端下工作的人来说,没有GUI界面看到当前系统日期是一个乏味的工作。你可以用‘**date**‘命令查看今天的日期。
|
||||
|
||||
Just execute the below command on you prompt and see the **date** and **time** on the above right corner of terminal.
|
||||
只要在提示符后输入如下的命令你就会在终端的右上角看到**日期**和**时间**。
|
||||
|
||||
root@tecmint [~]# while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &
|
||||
|
||||
![Show Date in Terminal](http://www.tecmint.com/wp-content/uploads/2013/11/Date.jpg)
|
||||
![在终端下显示日期](http://www.tecmint.com/wp-content/uploads/2013/11/Date.jpg)
|
||||
|
||||
### 36. convert Command ###
|
||||
### 36. convert 命令 ###
|
||||
|
||||
While writing tutorial, I usually need to produce output, many a times in image format. The above command combination does this for me. Say I need the output of tree command (for **/etc/x11** directory) in image format. What I did at terminal was:
|
||||
在写教程的时候,我经常需要生成输出,很多时候是图片格式。上面的命令集合并不适合我。假设我需要tree命令的图片格式的输出(对 **/etc/x11** 目录 )。
|
||||
|
||||
root@tecmint:/etc/X11# tree | convert label:@- /home/avi/tree.png
|
||||
|
||||
The output of the above command can be seen at the specified location (here, home directory of mine) with the file name specified as **tree.png**.
|
||||
上面命令的输出可以在一个特定的位置(这里是我的家目录)下看到,文件名是**tree.png**。
|
||||
|
||||
### 37. watch -t -n1 “date +%T|figlet” ###
|
||||
|
||||
Remember our description of “**figlet**” command in our earlier article “[20 Funny Commands of Linux][7]”. This command was very cool, this time we will be pipelining ‘**figlet**‘ to show animated digital clock in the terminal.
|
||||
记住“**figlet**”命令在我们早期的文章“[20 Funny Commands of Linux][7]”中的描述。这个命令非常酷,这次我们会通过管道输出到‘**figlet**‘而在终端上显示一个动画电子钟。
|
||||
|
||||
Just check-out yourself, remember you must have **figlet** installed on the system, do **apt** or **yum** to install the required package.
|
||||
你自己检查一下,记住你必须已经在系统上安装了**figlet**,用**apt** 或者 **yum**安装所需要的包。
|
||||
|
||||
root@tecmint [~]# watch -t -n1 "date +%T|figlet"
|
||||
|
||||
#### Sample Output ####
|
||||
#### 示例输出 ####
|
||||
|
||||
_ ___ ____ ___ _____ _ _ Fri Nov 29 10:29:34 GMT
|
||||
/ |/ _ \ _|___ \ / _ \ _|___ /| || |
|
||||
@ -101,9 +98,9 @@ Just check-out yourself, remember you must have **figlet** installed on the syst
|
||||
| | |_| |_ / __/ \__, |_ ___) |__ _|
|
||||
|_|\___/(_)_____| /_/(_)____/ |_|
|
||||
|
||||
### 38. host and dig Commands ###
|
||||
### 38. host and dig 命令 ###
|
||||
|
||||
Although “**host**” and “**dig**” command is not that much lesser known, still not very frequently used. The host command is **DNS** lookup utility.
|
||||
虽然“**host**” 和 “**dig**”命令不那么鲜为人知,但是仍并不常被使用。host命令是**DNS**查询工具。
|
||||
|
||||
root@tecmint [~]# host www.google.com
|
||||
|
||||
@ -123,17 +120,17 @@ Although “**host**” and “**dig**” command is not that much lesser known,
|
||||
;; Got answer:
|
||||
;; ->>HEADER<
|
||||
|
||||
### 39. dstat Command ###
|
||||
### 39. dstat 命令 ###
|
||||
|
||||
The **dstat** is a versatile tool, that generates statistics relating to system resource. By default your system might not have ‘**dstat**‘ installed. Do a **apt** or **yum** to install ‘**dstat**‘ before using this very colorful and description system resource generator.
|
||||
**dstat**是一个多用的工具,它会依据系统资源生成统计。默认上你的系统可能没有安装‘**dstat**‘。在使用这个多彩的描述系统信息的生成器前使用**apt** 或者 **yum**来安装。
|
||||
|
||||
root@tecmint [~]# dstat
|
||||
|
||||
![dstat command](http://www.tecmint.com/wp-content/uploads/2013/11/dstat.jpeg)
|
||||
![dstat 命令](http://www.tecmint.com/wp-content/uploads/2013/11/dstat.jpeg)
|
||||
|
||||
### 40. bind -p Command ###
|
||||
### 40. bind -p 命令 ###
|
||||
|
||||
The ‘**bind -p**‘ command will show all the shortcuts available for **BASH** shell.
|
||||
‘**bind -p**‘会显示所有的**BASH** shell可用的快捷方式。
|
||||
|
||||
root@tecmint [~]# bind -p
|
||||
|
||||
@ -164,19 +161,19 @@ The ‘**bind -p**‘ command will show all the shortcuts available for **BASH**
|
||||
|
||||
### 41. touch /forcefsck ###
|
||||
|
||||
The above command will create an empty folder '**forcefsck**', under root directory. This will force Linux System to check the file system on the very next boot.
|
||||
下面的命令会在root目录下创建一个空的文件夹'**forcefsck**'。这会强制Linux系统在下次启动时检查文件系统。
|
||||
|
||||
root@tecmint [~]# touch /forcefsck
|
||||
|
||||
hat’s all for Now. You People are loving these ‘**Lesser Known Commands**‘ and hence we are continuing the series, the next article of this series will be available very soon.
|
||||
今天这些就是全部。因为你们爱‘**鲜为人知的命令**‘ ,因此我们将继续这个系列,本系列的下一篇文章将很快发布。
|
||||
|
||||
Till then stay tuned and connected to **Tecmint**. Don’t forget to give your valuable feedback in our comment section. Do a favor to us, Like and share us and help us spread.
|
||||
不要走开继续关注**Tecmint**。不要忘记在评论栏里留下你们有价值的反馈。帮我们一个忙,喜爱、分享我们的文章,并帮我们传播。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/10-lesser-known-effective-linux-commands-part-iv/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
Loading…
Reference in New Issue
Block a user