Basic Shell Commands in Linux

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
In the world of Unix/Linux, shell commands are essential for interacting with the operating system and managing files. This blog post will introduce you to fundamental commands, their usage, and how to navigate the file system effectively.
ls - List Directory ContentsThe ls command lists the files and directories in the current working directory.
ls # List files and directories
ls -l # List in long format (detailed view)
ls -a # List all files, including hidden files
cd - Change DirectoryThe cd command allows you to change your current directory.
cd /path/to/directory # Navigate to a specific directory
cd .. # Go up one directory
cd ~ # Go to the home directory
cp - Copy Files and DirectoriesThe cp command copies files or directories.
cp source.txt destination.txt # Copy a file
cp -r source_directory/ target_directory/ # Copy a directory recursively
mv - Move or Rename Files and DirectoriesThe mv command moves files or directories and can also rename them.
mv oldname.txt newname.txt # Rename a file
mv file.txt /path/to/destination/ # Move a file
rm - Remove Files and DirectoriesThe rm command deletes files or directories.
rm file.txt # Remove a file
rm -r directory/ # Remove a directory and its contents recursively
mkdir - Create a New DirectoryThe mkdir command creates a new directory.
mkdir new_directory # Create a new directory
echo - Display a Line of TextThe echo command prints text or variables to the terminal.
echo "Hello, World!" # Print a message
cat - Concatenate and Display File ContentsThe cat command displays the contents of a file.
cat file.txt # Display the content of a file
touch - Create an Empty FileThe touch command creates an empty file or updates the timestamp of an existing file.
touch newfile.txt # Create a new empty file
grep - Search for Patterns in FilesThe grep command searches for specific patterns within files.
grep "search_term" file.txt # Search for a term in a file
awk - Pattern Scanning and Processing LanguageThe awk command is used for pattern scanning and processing.
awk '{print $1}' file.txt # Print the first column of a file
sed - Stream Editor for Filtering and Transforming TextThe sed command edits text in a stream.
sed 's/old/new/g' file.txt # Replace 'old' with 'new' in a file
find - Search for Files and DirectoriesThe find command searches for files and directories within a specified path.
find /path -name "filename" # Find files with a specific name
chmod - Change File PermissionsThe chmod command modifies file permissions.
chmod 755 file.txt # Set permissions to read, write, and execute for owner, and read and execute for others
Mastering these basic shell commands will greatly enhance your ability to navigate and manage files in a Unix/Linux environment. Whether you’re handling files, searching for specific content, or managing permissions, these commands are fundamental tools in your toolkit.
Practice these commands in your terminal, and soon you'll become proficient in managing your file system efficiently!