If you are not taking full advantage of Shell abbreviations, you are wasting valuable time. Typing the same thing over and over again is boring, monotonous, and inefficient. Why spend time memorizing lengthy commands when you can simplify them?
Abbreviations are a way of giving a name to a command, a sequence of commands, or a short piece of text. Rewrite this sentence as: You can achieve more efficient operations by chaining multiple commands together, or passing a long list of arguments to a commonly used command and giving it a shorter alias. This is useful if you want to give the same thing you type frequently a more memorable name.
Use abbreviations to reduce the time it takes to run commonly used commands. You can build the correct parameters into the abbreviations so they are never forgotten. If set up correctly, you can achieve some truly magical things with abbreviations.
In this article, I want to tell you some abbreviations that I use every day as an engineer. These abbreviations are an absolute life saver. They have become muscle memory and I honestly can't live without them.
1. Git status
alias gg='git status'
Simple, yes. Efficient? You can't imagine. You might be surprised to learn how many times git status is called per day. This is a very common command in Git repositories. This command shows which files are ready for commit, which branch you are currently on, and a lot of other useful information.
Typing git status might not seem too crazy, but see how long it takes? Look at the way your fingers dance across the keyboard. There's a space, and the characters themselves are spaced out in a specific pattern that's prone to error. Once you mess up, you need to start over. So much time wasted. Just abbreviate it.
Typing gg is much faster, if you make a typo then maybe consider a typing course...
2. Run Pylint
alias pll='pylint -f colorized'
Whatever you Love it or hate it, code inspectors are essential. Like it or not, no engineer is perfect. We all make mistakes at some point. You need to perform inspections on your code, so making it simple and easy is crucial.
Since I write a lot of Python code, I rely heavily on Pylint for code inspection. Sometimes I use custom parameters so I can run Pylint with colored output. It's not fun typing this stuff over and over again. Set it to a short abbreviation and it's now even more interesting.
You can specify different format types, ignore files, inspectors and .rc files to pass. Basically, anything you can pass to a normal command can be put in an abbreviation. This is where it's powerful, because you can customize the code inspector yourself without having to remember or re-enter all the options to suit your preferences.
3. Log in to ECR
alias ecr_login='aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <ecr_uri>'</ecr_uri></region>
This unique command is more practical than bread for people who often use Docker images and ECR. Logging into ECR is very tedious. To log in to Docker, you need to chain these commands together and use specific credentials. It's a real pain if you don't remember that command. Then you have to look it up, which wastes a lot of time.
Just set the login command to a concise and clear alias. If you work in multiple ECR regions, you can even alias based on region. Set up a login alias for the East Coast, the West Coast and even beyond. The world is your oyster, now you can log in quickly and easily.
Don't forget to add your own zone and ECR URI in the above command to make it work properly.
4. Running Ansible
alias apb='cd <repo> && ansible-playbook -i <inventory_file></inventory_file></repo>
For me, running Ansible playbooks is a daily routine. I run multiple plays every day, often repeatedly. Especially when I'm creating new roles or dealing with conditional logic in Ansible. Who doesn't love YAML as code?
It's very important to be able to run Ansible with the basic flags I need. Reentering a long list of parameters takes a long time. Although you can reuse a previously executed command by pressing the up arrow, this method is not always the most convenient. If you switch to editing the file, you now have to press the up arrow twice. This can easily be overlooked during development and then you have to type it all over again.
Just give it an alias.
如果你正在使用ansible.cfg文件,这也能给你机会确认。在上面的命令别名中,我们进入了我们的仓库并在该上下文中运行。这是因为我们的Ansible配置位于那里。一旦你进入那个目录,它会自动使用该配置。
如果有其他的清单文件,你也可以传入它们。如果你有一些跨多个环境的全局清单,这将非常有帮助。
5、缩短常用命令
alias tf='terraform'alias k='kubectl'
这是我最近开始实施的最后一个建议。我起初不认为这是必要的,但是一旦你开始使用缩写的命令代替长命令,就会有很大的区别。我每天都经常使用terraform和kubectl。
这些命令是另一个例子,它们的名称很烦人。它们容易出错,而将它们设为别名非常简单。现在就缩短它们,这样你就能避免拼写错误,提高方便。
我还鼓励你查看其他你经常输入的单词命令。可能有一些你一遍又一遍地输入的命令可以从缩短中受益。
现在,去给命令设置别名吧!
The above is the detailed content of Five super amazing shell aliases to use on Linux. For more information, please follow other related articles on the PHP Chinese website!

linux设备节点是应用程序和设备驱动程序沟通的一个桥梁;设备节点被创建在“/dev”,是连接内核与用户层的枢纽,相当于硬盘的inode一样的东西,记录了硬件设备的位置和信息。设备节点使用户可以与内核进行硬件的沟通,读写设备以及其他的操作。

区别:1、open是UNIX系统调用函数,而fopen是ANSIC标准中的C语言库函数;2、open的移植性没fopen好;3、fopen只能操纵普通正规文件,而open可以操作普通文件、网络套接字等;4、open无缓冲,fopen有缓冲。

端口映射又称端口转发,是指将外部主机的IP地址的端口映射到Intranet中的一台计算机,当用户访问外网IP的这个端口时,服务器自动将请求映射到对应局域网内部的机器上;可以通过使用动态或固定的公共网络IP路由ADSL宽带路由器来实现。

在linux中,交叉编译是指在一个平台上生成另一个平台上的可执行代码,即编译源代码的平台和执行源代码编译后程序的平台是两个不同的平台。使用交叉编译的原因:1、目标系统没有能力在其上进行本地编译;2、有能力进行源代码编译的平台与目标平台不同。

在linux中,eof是自定义终止符,是“END Of File”的缩写;因为是自定义的终止符,所以eof就不是固定的,可以随意的设置别名,linux中按“ctrl+d”就代表eof,eof一般会配合cat命令用于多行文本输出,指文件末尾。

在linux中,可以利用“rpm -qa pcre”命令判断pcre是否安装;rpm命令专门用于管理各项套件,使用该命令后,若结果中出现pcre的版本信息,则表示pcre已经安装,若没有出现版本信息,则表示没有安装pcre。

linux查询mac地址的方法:1、打开系统,在桌面中点击鼠标右键,选择“打开终端”;2、在终端中,执行“ifconfig”命令,查看输出结果,在输出信息第四行中紧跟“ether”单词后的字符串就是mac地址。

在linux中,rpc是远程过程调用的意思,是Reomote Procedure Call的缩写,特指一种隐藏了过程调用时实际通信细节的IPC方法;linux中通过RPC可以充分利用非共享内存的多处理器环境,提高系统资源的利用率。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
