Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to bypass Linux/Unix command aliases

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the methods of bypassing Linux/Unix command aliases, which are introduced in great detail and have certain reference value. Friends who are interested must finish reading!

I defined the following mount aliases on my Linux system:

Alias mount='mount | column-t'

But I need to bypass this bash alias when mounting file systems and other uses. How can I temporarily disable or bypass bash shell on Linux, * BSD, macOS, or Unix-like systems?

You can use the alias command to define or display bash shell aliases. Once bash shell aliases are created, they take precedence over external or internal commands. This article shows how to bypass bash aliases temporarily so that you can run actual internal or external commands.

Four ways to bypass bash aliases

Try any of the following methods to run commands that are bypassed by bash shell aliases. Let's define an alias as follows:

Alias mount='mount | column-t'

The operation is as follows:

Mount

Sample output:

Sysfs on / sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on / proc type proc (rw,nosuid,nodev,noexec Relatime) udev on / dev type devtmpfs (rw,nosuid,relatime,size=8023572k,nr_inodes=2005893,mode=755) devpts on / dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620 Ptmxmode=000) tmpfs on / run type tmpfs (rw,nosuid,noexec,relatime,size=1610240k,mode=755) / dev/mapper/ubuntu--vg-root on / type ext4 (rw,relatime,errors=remount-ro) Data=ordered) / dev/sda1 on / boot type ext4 (rw,relatime,data=ordered) binfmt_misc on / proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime) lxcfs on / var/lib/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime User_id=0,group_id=0,allow_other) method 1-use\ command

Enter the following command to temporarily bypass the bash alias named mount:

\ mount method 2-use "command" or 'command'

Invoke the actual / bin/mount using the mount command as follows:

"mount"

Or

'mount' method 3-use the full path of the command

Use the full binary path, such as / bin/mount:

/ bin/mount/bin/mount / dev/sda1 / mnt/sda method 4-use the internal command command

The syntax is:

Command cmdcommand cmd arg1 arg2

To override the aliases set in .bash _ aliases, such as mount:

Command mountcommand mount / dev/sdc / mnt/pendrive/

Command runs the command directly or displays information about the command. Running a command with arguments suppresses shell function queries or aliases, or displays information about a given command.

Description of the unalias command

To remove aliases from the list of defined aliases for the current session, use the unalias command:

Unalias mount

To remove all alias definitions from the current bash session:

Unalias-a

Make sure you update your ~ / .bashrc or $HOME/.bash_aliases. If you want to delete a defined alias, you must delete the defined alias:

Vi / .bashrc

Or

Joe $HOME/.bash_aliases

For more information, enter the following command to view:

Man bashhelp commandhelp unaliashelp alias above is all the contents of this article entitled "what are the ways to bypass Linux/Unix command aliases?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report