Linux 终端命令(Linux terminal commands)不必很无聊。许多命令对用户来说很酷、很有趣、很有趣。
本文将讨论一些支持 Linux 的命令技巧,以节省您的时间、减少挫败感并提高您的工作效率。
在后台暂停和运行 Linux 终端命令(Pause & Run Linux Terminal Commands In The Background)
您是否曾经在文件中键入文本到一半时,意识到您想在终端中添加另一个命令,但因为您在前台模式下打开了文本块而不能?
要在不中断您正在执行的操作的情况下返回Linux终端命令行,请按(Linux)CTRL+Z暂停前台应用程序。
现在您可以运行您想要的任何其他命令。完成后,您可以通过在终端窗口中输入fg然后单击返回来返回到先前暂停的会话。
在 Linux 终端中使用和搜索维基百科(Use & Search Wikipedia In Linux Terminal)
许多人使用维基百科(Wikipedia)在其庞大的知识数据库中搜索信息。谷歌(Google)经常将维基百科(Wikipedia)推向搜索引擎结果的顶部,以帮助用户快速找到他们正在寻找的内容。
Linux用户通过终端访问维基百科(Wikipedia)可以节省大量时间。使用 Wikit(Use Wikit)在您的Linux发行版中快速获得问题的答案。
Wikit Linux终端命令行将向用户显示来自 Wikipedia 的搜索主题的(Wikit) 摘要(Wikipedia)。首先(Start)在您的机器上安装Node.js。
在Mint(Mint)系统、Ubuntu或 Debian上运行以下命令:
sudo apt-get install nodejs
sudo apt-get install npm
要安装Wikit,请运行以下简单命令:
sudo npm install wikit -g
安装Wikit后,通过运行以下命令获取Wikipedia摘要:(Wikipedia)
wikit <search query>
请注意,您也可以使用多词查询。
蒸汽机车(Steam Locomotive)
你想看到蒸汽机车从右到左在你的Linux终端上运行吗?(Linux)如果您想为您的一天增添一点乐趣,请输入以下命令:
$ sudo apt-get install sl
如果未安装 sl 程序,则需要安装它:
$ sudo apt-get install sl
考赛(Cowsay)
(Create)在终端中创建一个ASCII(美国信息交换(Information Interchange)标准代码(Standard Code))牛(Cowsay),并使用Cowthink让它思考。
(Install Cowsay)使用以下Linux终端命令安装 Cowsay(适用于Debian OS ):
root@tecmint:~# apt-get install cowsay
使用以下命令告诉奶牛该想什么并说什么:
root@tecmint:~# cowsay I Love nix
在航站楼安装水族馆(Install an Aquarium in Terminal)
使用ASCIIQuarium(ASCIIQuarium)从您自己的终端内享受海洋的奥秘。如果您使用Fedora,安装它很容易,因为它在存储库中。使用这个命令:
$ sudo dnf install asciiquarium
如果您正在运行不同的发行版,请访问主页(the homepage)以获取有关如何下载它的更多信息。
或者,您可以安装Term-Animation,一个Perl模块。在命令行终端中键入以下内容:
$ sudo apt-get install libcurses-perl
$ cd /tmp
$ wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
$ tar -zxvf Term-Animation-2.4.tar.gz
$ cd Term-Animation-2.4/
$ perl Makefile.PL && make && make test
$ sudo make install
接下来,从Linux终端命令提示符处键入以下内容:
$ cd /tmp
$ wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
$ tar -zxvf asciiquarium.tar.gz
$ cd asciiquarium_1.0/
$ sudo cp asciiquarium /usr/local/bin
$ sudo chmod 0755 /usr/local/bin/asciiquarium
要查看您的水族馆,请使用以下命令:
$ perl /usr/local/bin/asciiquarium
浏览(Browsh)
Brosh(Browsh)是一个简单的、开源的、现代的基于文本的浏览器。当您没有良好的Internet连接时,它最有用,因为它有助于避免耗尽电池电量。
它播放视频和其他任何普通浏览器可以播放的内容。但是,它发生在终端环境中。
要在Linux中安装Browsh,您需要运行最新版本的Firefox和支持真彩色的终端客户端。
具备上述先决条件后,您可以为您的Linux发行版(Linux)下载正确的软件包(download the right package)。安装后,使用以下命令在终端上运行Brosh :(Browsh)
$ browsh
大多数鼠标和按键功能的工作方式与您在桌面浏览器上的预期相同。以下(Below)是一些最基本的功能:
- BACKSPACE回到历史
- CTRL+l聚焦 URL 栏
- F1打开文档
- CTRL+r重新加载页面
- 箭头键、PageUP、PageDown(ARROW KEYS, PageUP, PageDown)滚动
- CTRL+t打开一个新标签
- CTRL+w关闭选项卡
- CTRL+q退出程序
笑笑猫(Lolcat)
要以有趣的彩虹色打印文本,请使用 lolcat。要安装它,请使用以下代码:
# apt-get install lolcat
将其链接到其他Linux终端命令以在(Linux)Linux终端中查看彩虹色的输出。
搜索硬盘错误(Search For Hard Drive Errors)
使用smartctl监控硬盘驱动器的可靠性、预测驱动器故障并执行驱动器自检。
使用以下命令在 Ubuntu 中安装 smartctl:
$ sudo apt-get install smartmontools
要启动服务,我们使用以下命令:
$ sudo /etc/init.d/smartmontools start
要与其他发行版一起使用并查看示例,请阅读:Smartctl – 硬盘监控和分析工具(Smartctl – Monitoring and Analysis tool for Hard drive)。
Cpanel 备份和恢复(Cpanel Backup & Restore)
(Quickly)使用以下Linux(Linux)终端命令快速轻松地备份和恢复 cPanel 帐户文件:
/scripts/pkgacct username
/scripts/restoracct username
创建可启动驱动器(Create a Bootable Drive)
使用单个终端命令从 iso创建USB可启动驱动器:(USB)
$ dd if=/home/user/Downloads/ubuntu.iso of=/dev/sdb1 bs=512M; sync
上面的命令在 Debian 可启动驱动器中创建了一个USB驱动器 (/dev/sdb1)。
如果您在命令行上花费大量时间,上面的示例解释了一些技巧和快捷方式来提高您的工作效率。
您还可以使用与工作无关的Linux终端命令,只是为了好玩。(Linux)
10 Cool Linux Terminal Commands You Have to Try
Linux terminal commands don’t have to be boring. Many commands are cool, fun, and entertaining for users.
This article will discuss some pro-Linux command tricks to save you time, frustration, and increase your productivity.
Pause & Run Linux Terminal Commands In The Background
Have you ever been halfway through typing text into a file, realize that you want to add another command into the terminal, but can’t because you have opened the text tile in the foreground mode?
To get back to the Linux terminal command line without interrupting what you are doing, press CTRL+Z to pause the foreground application.
Now you can run any additional commands you want. When done, you can return to your previously paused session by entering fg into the terminal window and then clicking return.
Use & Search Wikipedia In Linux Terminal
Many people use Wikipedia to search through its vast database of knowledge for information. Google often pushes Wikipedia toward the top of search engine results to help users find what they are looking for quickly.
Linux users can save a lot of time by accessing Wikipedia in the terminal. Use Wikit to get answers to your questions quickly inside your Linux distribution.
The Wikit Linux terminal command line will show users summaries of search topics from Wikipedia. Start by installing Node.js on your machine.
Run the following commands on Mint systems, Ubuntu, or Debian:
sudo apt-get install nodejs
sudo apt-get install npm
To install Wikit, run the following simple command:
sudo npm install wikit -g
After you have installed Wikit, get Wikipedia summaries by running the following command:
wikit <search query>
Note that you can also use multi-word queries.
Steam Locomotive
Do you want to see a steam locomotive run across your Linux terminal from right to left? If you want to add a little fun to your day, type in the following command:
$ sudo apt-get install sl
If the sl program is not installed you will need to install it:
$ sudo apt-get install sl
Cowsay
Create an ASCII (American Standard Code for Information Interchange) cow (Cowsay) in a terminal and use Cowthink to make it think.
Install Cowsay (for Debian OS) with the following Linux terminal command:
root@tecmint:~# apt-get install cowsay
Tell the cow what to think and say using this command:
root@tecmint:~# cowsay I Love nix
Install an Aquarium in Terminal
Enjoy the mysteries of the sea from inside your own terminal with ASCIIQuarium. If you are using Fedora, installing it is easy as it is in the repositories. Use this command:
$ sudo dnf install asciiquarium
If you are running a different distribution, visit the homepage for more information on how to download it.
Or, you can install Term-Animation, a Perl module. Type the following into a command line terminal:
$ sudo apt-get install libcurses-perl
$ cd /tmp
$ wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
$ tar -zxvf Term-Animation-2.4.tar.gz
$ cd Term-Animation-2.4/
$ perl Makefile.PL && make && make test
$ sudo make install
Next, type the following from the Linux terminal command prompt:
$ cd /tmp
$ wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
$ tar -zxvf asciiquarium.tar.gz
$ cd asciiquarium_1.0/
$ sudo cp asciiquarium /usr/local/bin
$ sudo chmod 0755 /usr/local/bin/asciiquarium
To see your aquarium, use the command below:
$ perl /usr/local/bin/asciiquarium
Browsh
Browsh is a simple, open-source, and modern text-based browser. It is most useful when you don’t have a good Internet connection by helping to avoid draining your battery.
It plays videos and anything else that a regular browser can. However, it takes place in terminal environments.
To install Browsh in Linux, you need to be running the latest version of Firefox and a terminal client with true color support.
After you have the above prerequisites, you can download the right package for your Linux distribution.Once it’s installed, run Browsh on the terminal with the following command:
$ browsh
Most of the mouse and key functions work the same as you would expect on a desktop browser. Below are some of the most basic functions:
- BACKSPACE to go back in history
- CTRL+l to focus the URL bar
- F1 to open the documentation
- CTRL+r to reload page
- ARROW KEYS, PageUP, PageDown to scroll
- CTRL+t to open a new tab
- CTRL+w to close a tab
- CTRL+q to exit a program
Lolcat
To print your text in fun rainbow colors, use lolcat. To install it, use the code below:
# apt-get install lolcat
Link it to other Linux terminal commands to see an output of rainbow colors in Linux terminal.
Search For Hard Drive Errors
Use smartctl to monitor the reliability of your hard drive, predict drive failures, and perform drive self-tests.
Use the command below to install smartctl in Ubuntu:
$ sudo apt-get install smartmontools
To start the service, us the following command:
$ sudo /etc/init.d/smartmontools start
To use with other distributions and see examples read: Smartctl – Monitoring and Analysis tool for Hard drive.
Cpanel Backup & Restore
Quickly and easily backup and restore cPanel account files using the following Linux terminal commands:
/scripts/pkgacct username
/scripts/restoracct username
Create a Bootable Drive
Create a USB bootable drive from iso using a single terminal command:
$ dd if=/home/user/Downloads/ubuntu.iso of=/dev/sdb1 bs=512M; sync
The command above creates a USB drive (/dev/sdb1) into a Debian bootable drive.
If you spend a lot of time on the command line, the above examples explain some tricks and shortcuts to increase your productivity.
You can also use Linux terminal commands that have nothing to do with work just for the fun of it.