linux bash命令

Linux has a ton of commands, but most people only use a fraction of them. Here are some of the most used Linux commands to use in the terminal.

Linux有很多命令,但是大多数人只使用其中的一小部分。 以下是一些在终端中最常用的Linux命令。

First, we'll cover some tips that will make the command line easier to use:

首先,我们将介绍一些使命令行更易于使用的技巧:

  • Use tab for autocompletion. After you start typing something in the Linux terminal, hit tab and it will suggest possible options that start with the string you have typed so far.使用选项卡进行自动补全。 在Linux终端中开始输入内容后,请点击tab,它会建议可能的选项,以您到目前为止所输入的字符串开头。
  • Use ctrl+r search_term to search commands you have previously used.

    使用ctrl+r search_term搜索以前使用的命令。

  • Quickly move to the beginning or end of a line with ctrl+a and ctrl+e.

    使用ctrl+actrl+e快速移至行的开头或结尾。

  • Reuse the previous command in the present command with !!.

    !!重用当前命令中的前一个命令!!

  • You can run multiple commands in a single line by separating commands with a ;.

    您可以使用;分隔命令,从而在一行中运行多个命令;

It's time to learn the common Linux commands. You can get more information about any of these commands by using the man command. This will bring up the manual page for a command. For example, if you type man cat into a linux terminal, you will get more information about the cat command.

是时候学习常见的Linux命令了。 您可以使用man命令来获取有关这些命令中任何一个的更多信息。 这将显示命令的手册页。 例如,如果您在Linux终端中键入man cat ,您将获得有关cat命令的更多信息。

ls (ls)

List directory contents.Example: ls /applications will display all the files and folders stored in the applications folder.

列出目录内容。 示例: ls /applications将显示存储在Applications文件夹中的所有文件和文件夹。

光盘 (cd)

Change to a directory.Example: Change from the current directory to /usr/local with cd /usr/local.

转到目录。 例如:改变当前目录为/ usr /本地cd /usr/local

mv Rename or move file(s) or directories.Example: the command mv todo.txt /home/qlarson/Documents would move "todo.txt" to the "Documents" directory.

mv重命名或移动文件或目录。 示例:命令mv todo.txt /home/qlarson/Documents会将“ todo.txt”移动到“ Documents”目录。

麦克迪尔 (mkdir)

Create a new directory.Example: mkdir freecodecamp will make a directory named "freecodecamp".

创建一个新目录。 示例: mkdir freecodecamp将创建一个名为“ freecodecamp”的目录。

rmdir (rmdir)

Delete empty directories.

删除空目录。

触摸 (touch)

Create an empty file with the specified name.

用指定的名称创建一个空文件。

R M (rm)

Remove file(s) and/or directories.Example: rm todo.txt will delete the file.

删除文件和/或目录。 示例: rm todo.txt将删除该文件。

定位 (locate )

Locate a specific file.Example: locate -i vacuum*mop command will search for any file that contains the word "vacuum" and "mop". The -i makes the search case-insensitive.

找到一个特定的文件。 示例: locate -i vacuum*mop命令将搜索包含单词“ vacuum”和“ mop”的任何文件。 -i使搜索不区分大小写。

明确 (clear)

Clear a command line screen/window for a fresh start.

清除命令行屏幕/窗口以重新开始。

cp (cp)

Copy files and directories.Example: the command cp todo.txt /home/qlarson/Documents would create a copy of "todo.txt" to the "Documents" directory.

复制文件和目录。 示例:命令cp todo.txt /home/qlarson/Documents将创建“ todo.txt”的副本到“ Documents”目录。

别名 (alias )

Create an alias for Linux commands. Example: alias search=grep will allow you to use search instead of grep.

为Linux命令创建别名。 示例: alias search=grep将允许您使用search代替grep

猫 (cat)

Display the contents of a file on the screen. Example: cat todo.txt will show the text of "todo.txt" on the screen.

在屏幕上显示文件的内容。 示例: cat todo.txt将在屏幕上显示“ todo.txt”的文本。

wn (chown)

Change who owns a file.Example: chown qlarson todo.txt will make "qlarson" the owner of "todo.txt".

更改谁拥有文件。 示例: chown qlarson todo.txt将使“ qlarson”成为“ todo.txt”的所有者。

chmod (chmod)

Change a file’s permissions.Example: chmod 777 todo.txt will make "todo.txt" readable, writable, and executable by everyone. The digits in "777" specify the permissions for user, group, and others, in that order.

更改文件的权限。 例如: chmod 777 todo.txt将使“ todo.txt”对每个人都是可读,可写和可执行的。 “ 777”中的数字以该顺序指定用户,组和其他用户的权限。

须藤 (sudo)

Perform tasks that require administrative or root permissions.Example: Use sudo passwd quincy to change the password of user "quincy"."Sudo make me a sandwich."

执行需要管理或root权限的任务。 sudo passwd quincy :使用sudo passwd quincy更改用户“ quincy”的密码。 “须藤给我做一个三明治。”

找 (find )

Search for files matching a provided pattern. This command is for searching file(s) and folder(s) using filters such as name, size, access time, and modification time.Example: find /home/ -name todo.txt  will search for a file named "todo.txt" within the home directory and its subdirectories.

搜索与提供的模式匹配的文件。 此命令用于使用名称,大小,访问时间和修改时间等过滤器搜索文件和文件夹。 示例: find /home/ -name todo.txt将在主目录及其子目录中搜索名为“ todo.txt”的文件。

grep (grep )

Search files or output for a particular string or expression. This command searches for lines containing a specified pattern and, by default, writes them to the standard output.Example: grep run todo.txt will search for the word "run" in the "todo.txt" file. Lines that contain "run" will be displayed.

在文件或输出中搜索特定的字符串或表达式。 此命令搜索包含指定模式的行,并且默认情况下将其写入标准输出。 示例: grep run todo.txt将在“ todo.txt”文件中搜索单词“ run”。 将显示包含“运行”的行。

日期 (date)

Display or set the system date and time.

显示或设置系统日期和时间。

df (df)

Display report on the system’s disk space usage.

显示有关系统磁盘空间使用情况的报告。

杜 (du)

Show how much space each file takes up. This will show the size in disk block numbers. If you want to see it in bytes, kilobytes, and megabytes, add the -h argument like this: du -h.

显示每个文件占用了多少空间。 这将显示磁盘块号的大小。 如果要以字节,千字节和兆字节为单位查看它,请添加-h参数,例如: du -h

文件 (file)

Determine the type of a file. Example: file todo.txt would likely show the type of "ASCII text".

确定文件的类型。 例如: file todo.txt可能会显示“ ASCII文本”的类型。

历史 (history )

Shows the command history.

显示命令历史记录。

杀 (kill )

Stop a process.Example: Stop a process with a PID of 485 using the command kill 485. Use the ps command (below) to determine the PID of a process.

停止进程。 示例:使用命令kill 485停止PID为485的进程。 使用ps命令(如下)确定进程的PID。

减 (less)

View the contents of a file one page at a time.Example: less todo.txt will display the contents of "todo.txt".

一次一页查看文件内容。 示例: less todo.txt 将显示“ todo.txt”的内容。

ps Display a list of the currently running processes. This can be used to determine PIDs needed to kill processes.

ps显示当前正在运行的进程的列表。 这可以被用于确定所需要的PID kill进程。

密码 (pwd )

Display the pathname for the current directory. "print working directory"

显示当前目录的路径名。 “P RINT 瓦特工作会有d irectory”

ssh (ssh )

Remotely log in to another Linux machine, over the network. Example: ssh quincy@104.25.105.32 will login to 104.25.105.32 using the username "quincy".

通过网络远程登录到另一台Linux计算机。 示例: ssh quincy@104.25.105.32将使用用户名“ quincy”登录到104.25.105.32。

tail - Display the last 10 lines of a file. See fewer or more lines by using the -n (number) option.Example: tail -n 5 todo.txt will display the last 5 lines of "todo.txt".

tail-显示文件的最后10行。 使用-n(数字)选项可以查看更少或更多的行。 示例: tail -n 5 todo.txt将显示“ todo.txt”的最后5行。

柏油 (tar)

Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz).

从tarfile(.tar)或tarball(.tar.gz或.tgz)存储和提取文件。

最佳 (top )

Displays the resources being used on your system, similar to the task manager in Windows.

显示系统上正在使用的资源,类似于Windows中的任务管理器。

翻译自: https://www.freecodecamp.org/news/basic-linux-commands-bash-tips-you-should-know/

linux bash命令

linux bash命令_Linux命令-您应该知道的基本Bash命令行技巧相关推荐

  1. linux中cooy命令_Linux:CentOS 7中常用的基础命令

    对于学习Linux系统来说,命令是必须熟练掌握的第一个部分.Linux系统中的命令有600多个,但常用的基础命令并不多.虽然不同版本的Linux系统的命令稍有不同,但命令的语法与使用方法基本相同,因此 ...

  2. bz2解压命令_Linux文件操作之文件压缩与解压缩命令详解

    文件的压缩和解压缩是非常常见的操作,在 Windows 下我们有很多压缩和解压缩的工具,比如 zip.360 压缩等等.在 Ubuntu 下也有压缩工具,本节我们学习Ubuntu 下图形化以及命令行这 ...

  3. linux打印JAVA日志命令_Linux下查看日志用到的常用命令

    tail  -n  10  test.log   查询日志尾部最后10行的日志; tail -n +10 test.log    查询10行之后的所有日志; head: 跟tail是相反的,tail是 ...

  4. apache启服务命令_linux 下 apache启动、停止、重启命令

    基本的操作方法: 本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况 apahce启动命令: 推荐/usr/local/apache2/bin/apachec ...

  5. chmod 777命令_Linux用户权限管理及用户权限管理命令操作

    Ubuntu 是一个多用户系统,我们可以给不同的使用者创建不同的用户账号,每个用户使用各自的账号登陆,使用用户账号的目的一是方便系统管理员管理,控制不同用户对系统的访问权限,另一方面是为用户提供安全性 ...

  6. awk截取字符命令_Linux运维基础技能: 脚本编程与Linux命令

    本系列文章一共三篇,分别为<脚本编程与 Linux 命令>.<接入层与网络基础>和< MySQL 与 SQL 优化>,由腾讯高级工程师 luaruan(阮永顺) 原 ...

  7. linux关机命令_Linux基于centOS 7.6常见的Linux命令

    一.linux关机命令: 1.shutdown命令安全地将系统关机(推荐)参数说明: [-r] 重启计算器. [-h] 关机后关闭电源[halt]. [-c] cancel current proce ...

  8. linux export 生效_Linux之提高命令行的工作效率

    辉语:之前聊了很多关于Linux中的内容,今天我们继续跟大家分享一下Linux中非常重要的知识点:shell脚本的编写.今天,我们就一起来了解一下shell脚本. 编写简单shell脚本 shell是 ...

  9. linux 截取列_Linux 常用命令汇总

    Linux命令太多,主要写写自己平时使用频率较高的常用命令,内容是自己的笔记内容,所以整个逻辑看起来会比较乱.每条认真看,看完会有收获哦. 文中会出现大部分的伪代码,只是帮助自己记忆的. 1.LINU ...

最新文章

  1. R语言break函数和next函数实战
  2. 日益谨慎的谷歌AI,会在自我限制中越走越慢吗?
  3. 【深度学习】Squeeze-and-Excitation (SE) 模块优势解读
  4. a==b和a.equals(b)的区别
  5. Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 54; columnNumbe
  6. 一文看懂:边缘计算究竟是什么?为何潜力无限?(上)
  7. 【网络工程师必备】怎么使用route命令实现内外网切换
  8. 推荐一款绘画软件krita,开源正版免费,适合ps用户
  9. win10相机打不开,显示错误代码0xA00F4246(0x800706D9)
  10. 5.17 图层面板的使用 [原创Ps教程]
  11. 我建议你自己写一个疫情数据监控
  12. 有什么真无线蓝牙耳机推荐?2022蓝牙耳机全球排行榜
  13. SOHO设计师的多年工作经验总结
  14. 华为云NP考试题库_华为云服务考试 华为云hcip认证试题
  15. 在Keil 5上配置ST-Link下载器的方法 Windows 10
  16. 8. SpringBoot基础学习笔记
  17. 为何贩卖焦虑的文章如此受欢迎???
  18. 苹果手机怎么编辑word文档_word文档转pdf要怎么实现?word转pdf好方法推荐
  19. linux编译blas,CBLAS编译安装与使用举例
  20. 马明哲:平安最大对手是阿里和腾讯等现代科技企业

热门文章

  1. 【python】numpy array 找出符合条件的数并赋值
  2. MySQL—Linux查看客户端连接信息(连接数、进程等)及SpringBoot配置数据库模板
  3. 访问修饰符 c# 1613703072
  4. 爬虫-11-伪造电脑访问构建一个请求头
  5. dj电商-数据库的远程连接
  6. python -pymysql的操作
  7. python-字符串数据类型-定义与输出
  8. nginx之虚拟主机与请求的分发
  9. LC_ALL: cannot change locale (en_US.UTF8)问题解决
  10. 使用Hyper-V创建虚拟机