Practical application of Linux/shell commands -- added custom commands in alias

Source: Internet
Author: User
We can modify the/etc/bash. bashrc file (other users are in their respective directories) so that we can automatically load our custom commands when logging on to shell.

In the process of using linux, it is inevitable that a long string of commands will be bored if they are frequently typed ......

When calling some executable files, you have to write down a long string of parameters ......

We can modify the/etc/bash. bashrc file (other users are in their respective directories) so that we can automatically load our custom commands when logging on to shell.

For example:

My code directory is/home/ln/code/test/. I want to switch to this path every time I enter mycode in any path.

In the figure, I added alias mycode = 'CD/home/ln/code/test' to bash.


For example, if I often need to capture packets, the command line is as follows:

Capture packets with IP address 192.168.91.128 port 22, 80, and 8048
Tcpdump-I any host 192.168.1.123 and! Port 22 and! Port 80 and! Port 8048-w/opt/temp. cap

You can add the above command to the file using alias ...... Time-saving to improve efficiency

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.