- How to add bash auto completion in Ubuntu Linux
- How to add bash auto completion in Ubuntu Linux
- How to add bash completion In Ubuntu
- How to test programmable completion for Bash
- How to install bash shell in Alpine Linux
- How do I install bash shell in Alpine Linux?
- How to install bash man pages and other docs
- How to set bash as login shell
- Customize bash shell
- Install bash on linux
- RHEL / CentOS Linux install and activate Bash completion
- Packages to install and enable Bash completion on CentOS/RHEL
- RHEL / CentOS Linux install and activate Bash completion
- How to Install Linux Bash Shell on Windows 10
- What is Bash on Windows?
- Method 1: Install Linux Bash Shell on Windows 10 Newer Versions
- Step 1: Enable “Windows Subsystem for Linux” feature
- Step 2: Download a Linux system from the Windows store
- Step 3: Run Linux inside Windows 10
- Troubleshooting 1: The WSL optional component is not enabled. Please enable it and try again.
- Troubleshoot 2: Installation failed with error 0x80070003
- Method 2: Install Linux Bash Shell on older Windows 10
- Step 1:
- Step 2:
- Step 3:
- Step 4:
- Step 5:
- Step 6:
- Step 7:
- Step 8:
- Step 9:
- Step 10:
- Bonus Tip: Run GUI Apps On Windows Subsystem for Linux
- Step 1: Enable/Update WSL 2
- Step 2: Download and Install a Windows X Server Program
- Step 3: Configure Windows X Server
How to add bash auto completion in Ubuntu Linux
I set up a new Ubuntu Linux LXD container, but my auto-completion of bash shell commands are not working. How do I enable autocomplete feature in Ubuntu Linux 18.04/20.04 LTS? How do I write simple bash completion code in Ubuntu Linux?
Introduction: Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash can run most sh scripts without modification. bash-completion is a collection of shell functions that take advantage of the programmable completion feature of bash on Ubuntu Linux. This page shows how to install and enable Bash auto completion in Ubuntu Linux.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Ubuntu Linux |
Est. reading time | 3 minutes |
How to add bash auto completion in Ubuntu Linux
The procedure is as follows to add bash completion in Ubuntu:
- Open the terminal application
- Refresh package database on Ubuntu by running:
sudo apt update - Install bash-completion package on Ubuntu by running:
sudo apt install bash-completion - Log out and log in to verify that bash auto completion in Ubuntu Linux working properly.
Let us see all steps in details.
How to add bash completion In Ubuntu
Bash completion is a useful tool for the automatically completing of file names, commands and more. Type the following apt command/apt-get command to install auto completion in Ubuntu Linux:
$ sudo apt update
$ sudo apt install bash-completion
How to test programmable completion for Bash
Installer placed a shell script called /etc/profile.d/bash_completion.sh. You can view it with help of cat command:
$ cat /etc/profile.d/bash_completion.sh
Bash shell code that turn on bash smart completion feature
Источник
How to install bash shell in Alpine Linux
H ow do I install bash shell in my Alpine Linux LXD (Linux Container) or virtual machine (VM)?
Alpine Linux comes with BusyBox. It is described as “The Swiss Army Knife of Embedded Linux.” BusyBox combines tiny versions of many standard UNIX utilities into a single small executable, including /bin/sh. By default, bash is not included with BusyBox and Alpine Linux. The postmarketOS project, which is designed to run on mobile devices, is based on Alpine Linux. Many Docker images are also based upon Alpine, and you may install bash shell in Docker-based images too. This page shows how to install a bash shell in Alpine Linux using the apk command.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Alpine Linux |
Est. reading time | 3 mintues |
How do I install bash shell in Alpine Linux?
It is easy to have bash installed but this does not mean the symlinks to busybox are gone. The syntax is as follows with apk command:
# apk update
# apk upgrade
# apk add bash
Here is how it looks:
Get a list of valid login shells on Alpine Linux using the cat command:
# cat /etc/shells
Outputs:
How to install bash man pages and other docs
To install bash documentation, enter:
# apk add bash-doc
To install bash automatic command line completion support on Alpine Linux, run:
# apk add bash-completion
Sample session:
Fig.01: How to get bash working on Alpine Linux
How to set bash as login shell
To use bash as a shell just type bash:
$ bash
To login to alpine Linux LXD vm from host, enter:
$ lxc exec alpine-lxd-vm-name-here bash
One can change root shell to bash shell using the following method:
# vi /etc/passwd
Find user name and the default shell such as /bin/ash:
Replace it with /bin/bash:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Customize bash shell
Here is a sample file displayed using the cat command cat
Источник
Install bash on linux
Simple tool for configuring a fresh debian/ubuntu installation with just one command.
Note: I use this script for my own projects, it contains only the features I need.
Table of Contents
Requires: a Debian/Ubuntu version of linux and a Bash version
4.4. bash-sys installed. SSH is already installed and configured.
- Download a release or clone this repository.
- Use scripts/install.sh to automatically install the application in the /opt/oju/bash project folder.
- If needed, add PATH=»$PATH:/opt/oju/bash/bin» to the .profile files.
- Update the config.sh configuration file.
With just one command, this tool installs and configures all the softwares I need on a fresh debian/ubuntu server installation, like:
- Initial update and upgrade i. update source.list ii. update system iii. upgrade system
- Install or modify .bashrc, .bash_alias, .bash_profile, .profile files
- Configure swap
- Uninstall packages (vim-tiny, . )
- Install system packages (dkms, build-essential, util-linux, deborphan, localepurge, hdparm, smartmontools, . )
- Install and configure app packages (vim, fail2ban, ftp, mlocate, chkrootkit, logwatch, . )
- Optimize SSD
The local user name is defined in the config.sh file.
I didn’t write any line of ‘unit test’ code. Sorry.
Thanks you for taking the time to contribute. Please fork the repository and make changes as you’d like.
As I use these scripts for my own projects, they contain only the features I need. But If you have any ideas, just open an issue and tell me what you think. Pull requests are also warmly welcome.
If you encounter any bugs, please open an issue.
Be sure to include a title and clear description,as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
This project is open-source and is licensed under the MIT License.
Источник
RHEL / CentOS Linux install and activate Bash completion
H ow do I use bash auto complete features with various command on CentOS / RHEL / Fedora / Scientific Linux based systems?
Autocomplete is nothing but a collection of various hacks that specify how arguments are to be completed by Readline using complete built-in. By default, this feature is turned on many Linux distributions such as Debian Linux, Ubuntu Linux and more. However, this feature is not installed and turned on on RHEL based Linux distributions including CentOS Linux. This tutorials shows you how to install Bash Autocomplete feature on a CentOS/RHEL/Oracle/Scientific or Fedora Linux.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | RHEL/CentOS EPEL |
Est. reading time | 4 minuets |
Packages to install and enable Bash completion on CentOS/RHEL
You need to install two packages:
- bash-completion: Programmable completion for Bash
- bash-completion-extras : Additional programmable completions for Bash (only for CentOS/RHEL/Oracle/SL v7.x)
RHEL / CentOS Linux install and activate Bash completion
First, turn on the EPEL repo on a CentOS/RHEL version 6 (if you are using CentOS/RHEL 7.x, see this page to turn on EPEL repo) and type the following yum command to install bash-completion package:
# yum install bash-completion
OR
# yum install bash-completion bash-completion-extras
Sample outputs:
Источник
How to Install Linux Bash Shell on Windows 10
Last updated October 29, 2020 By Abhishek Prakash 125 Comments
Brief: This beginner’s tutorial shows you how to install bash on Windows.
Linux on Windows is a reality, thanks to the partnership between Canonical (parent company of Ubuntu) and Microsoft. When Microsoft’s CEO announced that the Bash shell was coming to Windows, a number of people just couldn’t believe it. #BashOnWindows trended on Twitter for days, such was the impact of this news.
But Bash on Windows was not available to everyone immediately. People had to install the Windows 10 technical preview to install Linux on Windows 10. But this is not the case anymore. The Windows 10 anniversary upgrade is here and now you can easily get Bash on Windows. And, before we go on installing Bash on Windows, let me tell you a little more about it.
Note: This tutorial was tested with the latest available Windows 10 version 2004 and build 19041.450. You might need to update your Windows installation if you’ve an older build to follow everything in this tutorial.
What is Bash on Windows?
Bash on Windows provides a Windows subsystem and Ubuntu Linux runs atop it. It is not a virtual machine or an application like Cygwin. It is complete Linux system inside Windows 10.
Basically, it allows you to run the same Bash shell that you find on Linux. This way you can run Linux commands inside Windows without the needing to install a virtual machine, or dual boot Linux and Windows. You install Linux inside Windows like a regular application. This is a good option if your main aim is to learn Linux/Unix commands.
I recommend reading this article to know more about Bash on Windows.
Method 1: Install Linux Bash Shell on Windows 10 Newer Versions
Good thing is that the Fall Creator’s Update and the recent Windows 10, version 2004 makes it easier to install Bash on Windows 10. You can get it in one click from Windows Store. There are still a few things to do however.
I am installing Ubuntu using Windows Subsystem for Linux. You can also use SUSE Linux. The procedure is same for both distributions.
Step 1: Enable “Windows Subsystem for Linux” feature
The first thing you need to do is to enable Windows Subsystem for Linux feature from PowerShell or from the Windows feature options.
If you want to utilize the GUI, you can simply search for option to get the list of Windows features to enable a few things as shown in the screenshot below.
Now, you just have to open it to access all the options. Among the ones listed, you have to enable (or check) the feature for “Windows Subsystem for Linux” and “Virtual Machine Platform” and then perform a reboot to make sure you have both of them enabled.
Windows Features Subsystem Virtual Option
In either case, if you want to utilize the PowerShell, you can just go to the Start menu and search for PowerShell. Run it as administrator:
Once you have the PowerShell running, use the command below to enable Bash in Windows 10.
You’ll be asked to confirm your choice. Type Y or press enter:
Now you should be asked to reboot. Even if you are not asked to, you must restart your system.
Step 2: Download a Linux system from the Windows store
Once your system has rebooted, go to the Windows Store and search for “Linux” or just “Ubuntu”.
You’ll see the option to install Ubuntu or SUSE. I have installed Ubuntu for Bash on Windows here.
What’s the difference between using Ubuntu or openSUSE or SUSE Linux Enterprise? And which one should you use?
To tell you quickly, the main difference would be in the commands for installing new packages inside these Linux subsystems. I advise going for Ubuntu in this case.
Once you choose the distribution of your choice, you’ll see the option to install it. Do note that it will download files of around 1Gb in size or less depending on what you’re downloading.
Step 3: Run Linux inside Windows 10
You are almost there. Once you have installed Linux, it’s time to see how to access Bash in Windows 10.
Just search for the Linux distribution you installed in the previous step. In my case it was Ubuntu. You’ll see that it runs like a normal Windows application.
It will take some time installing and then you’ll have to set up the username and password.
Don’t worry, it’s just for the first run. Bash shell will be available for use directly from the next time onwards.
Enjoy Linux inside Windows 10.
Troubleshooting 1: The WSL optional component is not enabled. Please enable it and try again.
You may see an error like this when you try to run Linux inside Windows 10:
And when you press any key, the application closes immediately.
The reason here is that the Windows Subsystem for Linux is not enabled in your case. You should enable it as explained in step 1 of this guide. You can do that even after you have installed Linux from Windows Store.
Troubleshoot 2: Installation failed with error 0x80070003
This is because Windows Subsystem for Linux only runs on the system drive i.e. the C drive. You should make sure that when you download Linux from the Windows Store, it is stored and installed in the C Drive.
Go to Settings -> Storage -> More Storage Settings: Change where new content is saved and select C Drive here.
Method 2: Install Linux Bash Shell on older Windows 10
If you cannot get the Fall Creator’s update on Windows 10 for some reason, you can still install it if you have the Anniversary update of Windows 10. But here, you’ll have to enable developer mode. I still recommend upgrading to the Fall Creator’s update or the latest Windows 10 2004 version update though.
Step 1:
Press Windows Key + I to access Windows system settings. In here, go to Update & Security:
Step 2:
From the left side pane, choose “For developers.” You’ll see an option for “Developer mode.” Enable it.
Step 3:
Now search for Control Panel and in Control Panel, click on “Programs”:
Step 4:
In Programs, click “Turn Windows features on or off”:
Step 5:
When you do this, you’ll see several Windows features. Look for “Windows Subsystem for Linux” and enable it.
Step 6:
You’ll need to restart the system after doing this.
Step 7:
After restarting the computer, click the start button and search for “bash”.
Step 8:
When you run it for the first time, you’ll be given the option to download and install Ubuntu. You’ll be asked to create a username and password during this process. It will install an entire Ubuntu Linux system, so have patience as it will take some time in downloading and installing Linux on Windows.
Step 9:
Once this is done, go back to the Start menu and search for Ubuntu or Bash.
Step 10:
Now you have a command line version of Ubuntu Linux. You can use apt to install various command line tools in it.
Bonus Tip: Run GUI Apps On Windows Subsystem for Linux
The ability to run GUI apps on Windows Subsystem for Linux was introduced with WSL 2 release in May 2020.
It’s still not something officially supported out-of-the-box, but if you’re curious, you can experiment with it by following the steps below:
Step 1: Enable/Update WSL 2
If you have the latest Windows version 2004, build 19041, you already have WSL 2 support but you need to enable it and set it to default instead of WSL 1.
To do that, first you need to ensure that you have the latest WSL 2 Linux Kernel by updating the WSL 2 Linux Kernel.
You just need to follow the instructions on the official documentation page and download/install the package. Once done, you need to launch the PowerShell (run it as administrator) and set WSL 2 as the default by typing the following command:
You should get a message that says “For information on key differences with WSL 2 please visit https://aka.ms/wsl2”.
In case you get an error (Error: 0x1bc), you need to make sure that you have updated the WSL 2 Linux Kernel, that solved the issue for me.
Step 2: Download and Install a Windows X Server Program
As I mentioned, WSL 2 does not have the official support for running GUI apps by default. So, to do it, we need to download and install a Windows X Server program to give WSL access to display the apps.
You can try the open-source XLaunch server that we’re using here.
Step 3: Configure Windows X Server
Now that you have installed it, you just need to configure a few things.
First, Launch XLaunch and proceed to ensure that you have the following options enabled:
1. Keep the Display number set as -1 and select “Multiple Windows“
2. Next, you need to enable “Start no client“.
3. Finally, you just need to check “Disable access control” to avoid permission issues and save the configuration on the next step to complete the configuration.
Now everything’s almost done, you need to launch Ubuntu from the list of apps installed and configure it to launch Linux GUI apps on Windows.
Just enter the following command in the Linux terminal (Ubuntu):
Now, just install your favorite Linux GUI app from the terminal and test if it works! In my case, I installed and launched Gedit using the following commands:
And, here’s how it looks:
I hope you find this tutorial helpful for installing bash on Windows 10 and experimenting Linux GUI apps on Windows 10. No wonder WSL lets you play with Linux inside of Windows. If you have questions or suggestions, feel free to ask.
Like what you read? Please share it with others.
Источник