博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何使Linux控制台更易于Linux新手使用
阅读量:2526 次
发布时间:2019-05-11

本文共 6855 字,大约阅读时间需要 22 分钟。

The Linux console may not be as user friendly as the GUI but it is faster and saves you a lot of time when you are doing simple repetitive tasks.This is may be a little bit subjective, but once you know how to do some tasks faster from the console you will not go back to the GUI to do them.

Linux控制台可能不如GUI那样用户友好,但是它速度更快并且可以在您执行简单的重复性任务时节省大量时间,这可能有点主观,但是一旦您知道如何更快地完成一些任务从控制台,您将不会返回到GUI来进行操作。

Installing Software from Optional Repositories

从可选存储库安装软件

There are thousands of Linux programs stored as software archives that are commonly referred to as ‘Repositories’. Ubuntu comes with four predefined repositories:

有成千上万的Linux程序存储为软件档案,通常称为“存储库”。 Ubuntu带有四个预定义的存储库:

  • Main – Officially supported software.

    Main –官方支持的软件。

  • Restricted – Supported software that is not available under a completely free license.

    受限 –受支持的软件,在完全免费的许可证下不可用。

  • Universe – Community maintained software, i.e. not officially supported software.

    Universe –社区维护的软件,即非官方支持的软件。

  • Multiverse – Software that is not free.

    Multiverse –不是免费的软件。

Ubuntu’s software repository is fully configurable and we can add new repositories in order to install software from other repositories outside the above predefined repositories.

Ubuntu的软件存储库是完全可配置的,我们可以添加新的存储库以从上述预定义存储库之外的其他存储库安装软件。

GUI-based repository management is normally accomplished via “Software Sources” that involves adding the repository from either the ‘Main Menu’ > ‘Administration’ > ‘Software Sources’ and then installing the software from the ‘Main Menu’ > ‘Ubuntu Software Centre’.

基于GUI的存储库管理通常通过“软件源”完成,该过程涉及从“主菜单”>“管理”>“软件源”添加存储库,然后从“主菜单”>“ Ubuntu软件中心”安装软件'。

Installing software through the console involve less mouse clicking and can be done by executing the following commands through the console. These commands will install CLICompanion and add its repository to your Ubuntu so that you will receive updates on the software.

通过控制台安装软件所涉及的鼠标点击较少,可以通过在控制台中执行以下命令来完成。 这些命令将安装CLICompanion并将其存储库添加到您的Ubuntu,这样您将收到该软件的更新。

Note: Press the ‘Enter’ key after each command

注意:每个命令后按“ Enter”键

sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies

sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies

sudo apt-get update

sudo apt-get update

sudo apt-get install clicompanion

sudo apt-get install clicompanion

Kill any Program

杀死任何程序

You will find that the console is a useful tool to kill an application that is acting up and causing your problem. Type ‘killall’ followed by the name of the program you’re trying to kill. If let just just say, your Firefox is eating up your computer resources, type

您会发现控制台是杀死正在运行并导致问题的应用程序的有用工具。 键入“ killall”,然后输入您要杀死的程序的名称。 如果只是说您的Firefox正在消耗您的计算机资源,请输入

killall firefox

killall firefox

and Linux will kill any Firefox instance running in your machine.

并且Linux将杀死您计算机上运行的所有Firefox实例。

Resizing Images

调整图像大小

Unless we’re editing our images with air brushing or colour adjustment, we can simply resize images through the console instead of a full blown image editing software such as GIMP using a simple command:

除非我们使用空气刷或色彩调整来编辑图像,否则我们可以通过控制台简单地调整图像的大小,而不是使用简单的命令通过功能强大的图像编辑软件(例如GIMP)来调整图像大小:

convert -resize 100 original_image.JPG smaller_img.jpg

convert -resize 100 original_image.JPG smaller_img.jpg

Finding Text

查找文字

The console provides a simple yet powerful tool to search for text in text file called ‘grep’. The basic grep command is as follow:

控制台提供了一个简单而强大的工具来搜索名为“ grep”的文本文件中的文本。 基本的grep命令如下:

grep "string" file_name

grep "string" file_name

where “string” is the particular text that we are looking for and file_name can be either an existing file name or a file name pattern. A more useful example that we can do with ‘grep’ is to find a particular text in a file

其中“字符串”是我们要查找的特定文本,而file_name可以是现有文件名或文件名模式。 我们可以用'grep'做的一个更有用的例子是在文件中查找特定文本

grep -C 1 "line" ./*.txt

grep -C 1 "line" ./*.txt

The above command looks for any occurrences of the word “line” in every ‘*.txt’ files.

上面的命令查找每个“ * .txt”文件中是否出现“ line”一词。

‘grep’ is a very flexible command that we can combine to filter output from other command such as the ‘ps’ command that displays active processes. Let just say you want to look for every Firefox process running in your Linux, just run the following command

“ grep”是一个非常灵活的命令,我们可以将其组合以过滤其他命令的输出,例如显示活动进程的“ ps”命令。 假设您要查找Linux中运行的每个Firefox进程,只需运行以下命令

ps -ef | grep 'firefox'

ps -ef | grep 'firefox'

The pipe character means that we are feeding the list of active processes to the ‘grep’ command that will look only for any processes linked to Firefox.

竖线字符表示我们正在将活动进程列表馈送到“ grep”命令,该命令将仅查找链接到Firefox的所有进程。

向您的控制台添加伴侣 (Adding A Companion to Your Console)

CLICompanion help beginners to get comfortable with command lines by giving a dictionary of commonly used commands. We can also customize CLICompanion’s dictionary by adding our own frequently used commands making it easier for us to refer back to those commands.

CLICompanion通过提供常用命令的词典来帮助初学者熟悉命令行。 我们还可以通过添加自己的常用命令来自定义CLICompanion的字典,从而使我们更容易引用这些命令。

Selecting the ‘Add menu’ will open a simple command editing form to add command into CLICompanion dictionary.

选择“添加菜单”将打开一个简单的命令编辑表单,以将命令添加到CLICompanion词典中。

CLICompanion makes it easier for us to run commands by selecting one of the command in the dictionary and clicking the apply button to run the command.

通过选择词典中的命令之一,然后单击应用按钮来运行命令,CLICompanion使我们可以更轻松地运行命令。

The tabs allow us to open multiple console and run them simultaneously.

这些选项卡使我们可以打开多个控制台并同时运行它们。

控制台手册页 (The Console Manual Page)

The console comes with a manual page, or man for short, that gives us detail instructions on the available commands in your console. If we want to know what ‘mv’ does then type man -mv to read the ‘mv’ command’s manual.

控制台带有一个手册,或男人的短,这给了我们在控制台中的可用命令详细说明。 如果我们想知道'mv'的作用,请键入man -mv以阅读'mv'命令的手册。

If you’re not sure about what commands that you need to use to do a particular task, you can use man -k "task name" where task name is brief description of the task that you are looking for.

如果不确定执行特定任务需要使用哪些命令,则可以使用man -k "task name" ,其中任务名称是要查找的任务的简短描述。

Let just say you want to search for a command to ping a network address, run the following command and Linux will search command that mention the word ‘ping’:

假设您要搜索命令来ping网络地址,请运行以下命令,Linux将搜索提到“ ping”一词的命令:

man -k ping

man -k ping

If you happen to have installed in your Linux, you can browse the man page in a nicely formatted web pages making it way easier to browse the details of the commands.

如果您恰巧在Linux中安装了 ,则可以在格式正确的网页中浏览手册页,从而更轻松地浏览命令的详细信息。

结论 (Conclusion)

Most of the task that we can do in the console can also be done in the GUI and it will be easier to use the GUI wizards to do the unnecessary dirty works of typing commands through the console. Nobody says that we should use the console, but we can definitely execute simple repetitive tasks faster through the console.

我们可以在控制台中完成的大多数任务也可以在GUI中完成,并且使用GUI向导可以更轻松地完成通过控制台键入命令的不必要工作。 没有人说我们应该使用控制台,但是我们绝对可以通过控制台更快地执行简单的重复性任务。

翻译自:

转载地址:http://ilywd.baihongyu.com/

你可能感兴趣的文章
读大道至简第三章有感
查看>>
BeforeFieldInit的小叙
查看>>
TeamViewer的下载地址,低调低调
查看>>
005 线程ID和线程的优先级
查看>>
POJ 3067 Japan (树状数组 && 控制变量)
查看>>
python基础条件和循环
查看>>
an exciting trip
查看>>
【转】xmind8 破解激活教程
查看>>
Mysql用命令方式启动服务
查看>>
【贪心】codeforces A. Heidi and Library (easy)
查看>>
【leetcode】lower_bound
查看>>
跨站请求伪造(CSRF)
查看>>
EF Code First数据库映射规则及配置
查看>>
.Net StackFrame
查看>>
Qt 学习之路:视图选择 (QItemSelectionModel)
查看>>
QStyleFactory类参考
查看>>
linux 获取系统屏幕分辨率
查看>>
MySQL 数据库常用命令小结
查看>>
log4net使用记录
查看>>
The Django Book 2.0--中文版
查看>>