mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-12 01:40:10 +08:00
commit
8f8fb9a0e9
@ -1,128 +0,0 @@
|
||||
Translating by Ping
|
||||
|
||||
10 Basic Linux Commands That Every Linux Newbies Should Remember
|
||||
=====================================================================
|
||||
|
||||

|
||||
|
||||
[Linux][1] has a big impact on our Lives. At least, your android phone has Linux kernel on it. However, getting started with Linux just make you discomfort for the first time. Because on Linux, you usually should use terminal commands instead of just clicking the launcher icon (as you did on Windows). But don't worry, We will give you 10 basic Linux commands & important commands that will help you get started.
|
||||
|
||||
|
||||
### 10 Basic Linux Commands That Help Newbies Get Started
|
||||
|
||||
When We talk about Linux commands, what we are really talking about is the Linux system itself. These small number of 10 Basic Linux commands will not make you a genius or a Linux expert instead, it'll help you get started with Linux. It'll help Linux newbies to perform daily basic tasks in Linux using these Linux basic commands or I should say Linux top commands(because of their usage).
|
||||
|
||||
So let's get started with the list of 10 Linux Basic commands -
|
||||
|
||||
#### 1. sudo
|
||||
|
||||
This SuperUserDo is the most important command Linux newbies will use. Every single command that needs root's permission, need this sudo command. You can use sudo before each command that requires root permissions -
|
||||
|
||||
```
|
||||
$ sudo su
|
||||
```
|
||||
|
||||
#### 2. ls (list)
|
||||
|
||||
Just like the other, you often want to see anything in your directory. With list command, the terminal will show you all the files and folders of the directory that you're working in. Let's say I'm in the /home folder and I want to see the directories & files in /home.
|
||||
|
||||
```
|
||||
/home$ ls
|
||||
```
|
||||
|
||||
ls in /home returns the following -
|
||||
|
||||
```
|
||||
imad lost+found
|
||||
```
|
||||
|
||||
#### 3. cd
|
||||
|
||||
Changing directory (cd) is the main command that always be in use in terminal. It's one of the most Linux basic commands. Using this is easy. Just type the name of the folder you want to go in from your current directory. If you want to go up just do it by giving double dots (..) as the parameter.
|
||||
|
||||
Let's say I'm in /home directory and I want to move in usr directory which is always in the /home. Here is how I can use cd commands -
|
||||
|
||||
```
|
||||
/home $ cd usr
|
||||
|
||||
/home/usr $
|
||||
```
|
||||
|
||||
#### 4. mkdir
|
||||
|
||||
Just changing directory is still incomplete. Sometimes you want to create a new folder or subfolder. You can use mkdir command to do that. Just give your folder name after mkdir command in your terminal.
|
||||
|
||||
```
|
||||
~$ mkdir folderName
|
||||
```
|
||||
|
||||
#### 5. cp
|
||||
|
||||
copy-and-paste is the important task we need to do to organize our files. Using cp will help you to copy-and-paste the file from terminal. First, you determine the file you want to copy and type the destination location to paste the file.
|
||||
|
||||
```
|
||||
$ cp src des
|
||||
```
|
||||
|
||||
Note: If you're copying files into the directory that requires root permission for any new file, then you'll need to use sudo command.
|
||||
|
||||
#### 6. rm
|
||||
|
||||
rm is a command to remove your file or even your directory. You can use -f if the file need root permission to be removed. And also you can use -r to do recursive removal to remove your folder.
|
||||
|
||||
```
|
||||
$ rm myfile.txt
|
||||
```
|
||||
|
||||
#### 7. apt-get
|
||||
|
||||
This command differs distro-by-distro. In Debian based Linux distributions, to install, remove and upgrade any package we've Advanced Packaging Tool (APT) package manager. The apt-get command will help you installing the software you need to run in your Linux. It is a powerful command-line tool which can perform installation, upgrade, and even removing your software.
|
||||
|
||||
In other distributions, such as Fedora, Centos there are different package managers. Fedora used to have yum but now it has dnf.
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
|
||||
$ sudo dnf update
|
||||
```
|
||||
|
||||
#### 8. grep
|
||||
|
||||
You need to find a file but you don't remember its exact location or the path. grep will help you to solve this problem. You can use the grep command to help finding the file based on given keywords.
|
||||
|
||||
```
|
||||
$ grep user /etc/passwd
|
||||
```
|
||||
|
||||
#### 9. cat
|
||||
|
||||
As a user, you often need to view some of text or code from your script. Again, one of the Linux basic commands is cat command. It will show you the text inside your file.
|
||||
|
||||
```
|
||||
$ cat CMakeLists.txt
|
||||
```
|
||||
|
||||
#### 10. poweroff
|
||||
|
||||
And the last one is poweroff. Sometimes you need to poweroff directly from your terminal. This command will do the task. Don't forget to add sudo at the beginning of the command since it needs root permission to execute poweroff.
|
||||
|
||||
```
|
||||
$ sudo poweroff
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
As I mentioned when I started off the article that these 10 basic Linux commands will not make you a Linux geek immediately. It'll help you to start using Linux at this early stage. With these basic Linux commands, start using Linux and set your target to learn 1-3 commands daily. So it's all for this article. I hope it helped you. Share with us interesting and useful commands in the comment section below and don't forget to share this article with your friends.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxandubuntu.com/home/10-basic-linux-commands-that-every-linux-newbies-should-remember
|
||||
|
||||
作者:[Commenti][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.linuxandubuntu.com/home/10-basic-linux-commands-that-every-linux-newbies-should-remember#comments
|
||||
[1]: http://linuxandubuntu.com/home/category/linux
|
@ -0,0 +1,141 @@
|
||||
Linux新手必知必会的10条Linux基本命令
|
||||
=====================================================================
|
||||
|
||||

|
||||
|
||||
|
||||
[Linux][1]对我们的生活产生了巨大的冲击。至少你的安卓手机使用的就是Linux核心。尽管如此,在第一次开始使用Linux时你还是会感到难以下手。因为在Linux中,通常需要使用终端命令来取代Windows系统中的点击启动图标操作。但是不必担心,这里我们会介绍10个Linux基本命令来帮助你开启Linux神秘之旅。
|
||||
|
||||
|
||||
### 帮助新手走出第一步的10个Linux基本命令
|
||||
|
||||
当我们谈论Linux命令时,实质上是在谈论Linux系统本身。这短短的10个Linux基本命令不会让你变成天才或者Linux专家,但是能帮助你轻松开始Linux之旅。使用这些基本命令会帮助新手们完成Linux的日常任务,由于它们的使用频率如此至高,所以我更乐意称他们为Linux命令之王!
|
||||
|
||||
让我们开始学习这10条Linux基本命令吧。
|
||||
|
||||
|
||||
#### 1. sudo
|
||||
|
||||
这条命令的意思是“以超级用户的身份执行”,是 SuperUserDo 的简写,它是新手将要用到的最重要的一条Linux命令。当一条单行命令需要root权限的时候,`sudo`命令就派上用场了。你可以在每一条需要root权限的命令前都加上`sudo`。
|
||||
|
||||
```
|
||||
$ sudo su
|
||||
```
|
||||
|
||||
|
||||
#### 2. ls (list)
|
||||
|
||||
|
||||
跟其他人一样,你肯定也经常想看看目录下都有些什么东西。使用列表命令,终端会把当前工作目录下所有的文件以及文件夹展示给你。比如说,我当前处在 /home 文件夹中,我想看看 /home文件夹中都有哪些文件和目录。
|
||||
|
||||
```
|
||||
/home$ ls
|
||||
```
|
||||
|
||||
|
||||
在/home中执行`ls`命令将会返回以下内容
|
||||
|
||||
```
|
||||
imad lost+found
|
||||
```
|
||||
|
||||
|
||||
#### 3. cd
|
||||
|
||||
变更目录命令(cd)是终端中总会被用到的主要命令。他是最常用到的Linux基本命令之一。此命令使用非常简单,当你打算从当前目录跳转至某个文件夹时,只需要将文件夹键入此命令之后即可。如果你想跳转至上层目录,只需要在此命令之后键入两个点(..)就可以了。
|
||||
|
||||
举个例子,我现在处在/home目录中,我想移动到/home目录中的usr文件夹下,可以通过以下命令来完成操作。
|
||||
|
||||
```
|
||||
/home $ cd usr
|
||||
|
||||
/home/usr $
|
||||
```
|
||||
|
||||
|
||||
#### 4. mkdir
|
||||
|
||||
只是可以切换目录还是不够完美。有时候你会想要新建一个文件夹或子文件夹。此时可以使用mkdir命令来完成操作。使用方法很简单,只需要把新的文件夹名跟在mkdir命令之后就好了。
|
||||
|
||||
```
|
||||
~$ mkdir folderName
|
||||
```
|
||||
|
||||
|
||||
#### 5. cp
|
||||
|
||||
拷贝-粘贴(copy-and-paste)是我们组织文件需要用到的重要命令。使用 `cp` 命令可以帮助你在终端当中完成拷贝-粘贴操作。首先确定你想要拷贝的文件,然后键入打算粘贴此文件的目标位置。
|
||||
|
||||
```
|
||||
$ cp src des
|
||||
```
|
||||
|
||||
注意:如果目标目录对新建文件需要root权限时,你可以使用`sudo`命令来完成文件拷贝操作。
|
||||
|
||||
|
||||
#### 6. rm
|
||||
|
||||
rm命令可以帮助你移除文件甚至目录。如果文件需要root权限才能移除,可以用`-f`参数来强制执行。也可以使用`-r`参数来递归的移除文件夹。
|
||||
|
||||
```
|
||||
$ rm myfile.txt
|
||||
```
|
||||
|
||||
|
||||
#### 7. apt-get
|
||||
|
||||
这个命令会依据发行版的不同而有所区别。在基于Debian的发行版中,我们拥有Advanced Packaging Tool(APT)包管理工具来安装、移除和升级包。apt-get命令会帮助你安装需要在Linux系统中运行的软件。它是一个功能强大的命令行,可以用来帮助你对软件执行安装、升级和移除操作。
|
||||
|
||||
在其他发行版中,例如Fedora、Centos,都各自不同的包管理工具。Fedora之前使用的是yum,不过现在dnf成了它默认的包管理工具。
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
|
||||
$ sudo dnf update
|
||||
```
|
||||
|
||||
|
||||
#### 8. grep
|
||||
|
||||
当你需要查找一个文件,但是又忘记了它具体的位置和路径时,`grep`命令会帮助你解决这个难题。你可以提供文件的关键字,使用`grep`命令来查找到它。
|
||||
|
||||
```
|
||||
$ grep user /etc/passwd
|
||||
```
|
||||
|
||||
|
||||
#### 9. cat
|
||||
|
||||
作为一个用户,你应该会经常需要浏览脚本内的文本或者代码。`cat`命令是Linux系统的基本命令之一,它的用途就是将文件的内容展示给你。
|
||||
|
||||
```
|
||||
$ cat CMakeLists.txt
|
||||
```
|
||||
|
||||
|
||||
#### 10. poweroff
|
||||
|
||||
最后一个命令是 `poweroff`。有时你需要直接在终端中执行关机操作。此命令可以完成这个任务。由于关机操作需要root权限,所以别忘了在此命令之前添加`sudo`。
|
||||
|
||||
```
|
||||
$ sudo poweroff
|
||||
```
|
||||
|
||||
|
||||
### 总结
|
||||
|
||||
如我在文章开始所言,这10条命令并不会让你立即成为一个Linux大拿。它们会让你在初期快速上手Linux。以这些命令为基础,给自己设置一个目标,每天学习一到三条命令,这就是此文的目的所在。在下方评论区分享有趣并且有用的命令。别忘了跟你的朋友分享此文。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxandubuntu.com/home/10-basic-linux-commands-that-every-linux-newbies-should-remember
|
||||
|
||||
作者:[Commenti][a]
|
||||
译者:[mr-ping](https://github.com/mr-ping)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.linuxandubuntu.com/home/10-basic-linux-commands-that-every-linux-newbies-should-remember#comments
|
||||
[1]: http://linuxandubuntu.com/home/category/linux
|
Loading…
Reference in New Issue
Block a user