Table of contents
What is Linux?
Linux is an open-source operating system kernel developed by Linus Torvalds in 1991. It serves as the foundation for various operating systems known as "Linux distributions." Linux is highly customizable, adaptable to different devices, and widely used in web servers, cloud computing, and scientific research. It is known for its stability, security, and cost-effectiveness, making it a popular choice for a wide range of applications.
Why Linux?
Open Source: Linux is open-source, meaning its source code is freely available, allowing users to modify and distribute it without restrictions.
Stability: Linux is known for its stability and reliability, making it suitable for critical systems and servers.
Security: Linux's open-source nature allows for continuous scrutiny, making it less prone to malware and security vulnerabilities.
Flexibility: Linux can be customized and adapted to run on a wide range of devices and platforms.
Performance: Linux is efficient and optimized for various hardware configurations, ensuring better performance.
Community Support: A large and active community contributes to Linux's development, providing support and updates.
Basic Linux Commands
pwd command
Print the working directory (displays the current directory you are in).
ls command
ls: List files and directories in the current directory
ls
: List files and directories in a simple format.ls -l
: List files and directories in long format with detailed information.ls -a
: List all files, including hidden files (those starting with a dot).
cd: Change directory.
It is used to change the current directory of the terminal.
cd directory_name
: Move to a specific directory.cd ..
: Move up one level to the parent directory.cd
: Return to the home directory.cd ~
: The '~' symbol means user home directory.
Creation of Directories
mkdir: Create a new directory.
mkdir directory_name
: Create a new directory with the given name.
mkdir apps windows ios
: To create multiple directories at once.
mkdir -p A/B/C/D/E
: The -p
flag indicates the path of directories.
• All directories in the specified path will be created. This will create the directory structure as I specified, with directories A, B, C, D, and E nested inside each other
Remove Directory
rmdir: Remove a directory (only works for empty directories).
rmdir directory_name
: Remove the specified empty directory.
touch: Create an empty file.
touch file_name
: Create a new empty file with the given name.
cp: Copy files or directories.
cp source_file destination_file
: Copy a file to a new location.cp -r source_directory destination_directory
: Copy a directory and its contents recursively.
mv: Move or rename files or directories.
mv old_name new_name
: Rename a file or directory.mv source destination_directory
: Move a file or directory to a new location.
cat: Display the contents of a file.
cat file_name
: Output the contents of the specified file.
chmod: Change file permissions.
chmod permissions file_name
: Change the permissions of a file (e.g., chmod 644 file_name
).