Linux is one of the most widely used open-source OS because of its safety, security features, and ease of use. In the cloud, you will find it in IoT, big data, DevOps, networking, data management, compute, and much more.
Major cloud providers like AWS, GCP, AZURE, Oracle & IBM Cloud have virtual machines running a variation of the Linux operating system like Ubuntu, Redhat, open SUSE, KALI Linux, CentOS, Fedora, etc. You will need to understand the bash commands to SSH Into such virtual machines or even use the command line.
for a beginner working with bash the terminal can look intimidating and you might think it's only meant for people with programming knowledge, which isn't true.in my experience bash has a small learning curve as compared to some programming languages.
in my case when I got into the cloud computing space I used to avoid using the CLI as much as possible but with practice, I got better at it and I now prefer using the CLI to the console. interacting with IAAS like Terraform or Ansible without knowing basic CLI commands is impossible so it's better to get used to it in the first place if you desire to build a career on the cloud.
Bash commands for AWS, Azure, GCP, Oracle, IBM Cloud & other clouds
all the major cloud providers have a cloud shell CLI to enable developers to build or destroy from the command line. you should note, to begin with, that the CLI is case sensitive ls and LS and 2 different commands so use lowercase letters unless stated otherwise.
the below commands are for bash which is native to Linux distros and not PowerShell.if you are interacting with PowerShell like on Azure cloud shell make sure to use their commands as they are not all the same as bash commands.
head -display just the beginning of a file, by default 10 lines
tail -displays the end of a file and does the opposite of the head command.
less - returns the content of a file one page at a time.
Once you’ve accessed your content with the less command, you can use several keyboard controls to move through the file
Space bar -Move forward one page
b -Move back one page
Down arrow -Move forward one line
Up arrow -Move back one line
q -Quit and return to the previous terminal window
ls -an argument used to list the contents of a directory.
ls-l command gives a detailed list such as file type, permissions, and timestamp.
ls -lt command sorts the files by timestamp.
ls -l -t command sorts the file by size.
pwd- print working directory used to discover where you currently are in the file system.
cd-change directory can be used to change from the current directory to another.
su- allows you to create a new cloud shell environment temporarily and act as a different user. to exit use the exit command to return the the admin account.
sudo-allows a user to execute a command as another user without creating a new shell. sudo gives a user administrative privileges.
sudo stands for superuser do.
chmod-used to change the permissions of a file or directory. Only the root user or file owner can be able to change permissions.
chown-used to change the ownership of a file and directory.
cp- used to copy files, you however need to have access/read permissions to execute.
cat-used to quickly view the entire contents of a file.
mv- Similar to the copy command it is used to move files from one location in the file system to another. It also requires both a source and destination file path and necessary execution permissions.
find -searches for directories and files that meet specified criteria
grep - searches a specified file and returns all lines in the file containing a specified string
piping -accessed using the pipe character (|). Piping sends the standard output of one command as standard input to another command for further processing
rm-command is used to permanently delete files and directories.
whoami-to find out your username
gprep-command is used to search, filter and interpret text patterns presenting a matched result.
shutdown-used to shut down the terminal in a safe way by the root account. the command needs a time argument specifying when the shutdown should begin.
ps-lists processes running on the cloud shell terminal by default
ps-e will display every process running in the system
sudo apt-get update-administrative command to install package files from repositories.
apt-get update shows the current list of available packages ready for download.
APT (advanced packaging tool) is a command used to install new software packaging and upgrade existing ones.
apt-get install- command to install/update a package by name
apt-get update-get package list from the package repository and update the local package database
apt-get upgrade-update all currently installed packages to their latest versions.
apt-get remove-command to delete all the files of a package except the configuration files.
apt-get purge-command to delete all package files from the system together with the configuration files.
passwd-used to update a user's password. Users can only change their passwords but admins can change any password.
echo-command prints the output to the terminal if used to add a comment or note to a file. Echo can also replace original content in a text through redirection.
CTRL +C breaks a continuous running process on the cloud shell.
mkdir -make directory command.
ssh-keygen command to create a key pair for your VM.
cat ..ssh/id_rsa.pub command to view your public key and use it with a VM.
Ready to level up your Linux skills? Dive into expert-led courses and tutorials that will boost your expertise. Start learning today with this special link!
Top comments (0)