#2 Exploring the Basics of Linux Commands
Abhishek Dhatrak
Trainee Software Analyst @Mindgate | Proficient in Java, MySQL, Linux , Web development , React.js & Node.js
During my training at Mindgate Solutions , I had the opportunity to delve deep into the Linux operating system. We set up virtual environments using VirtualBox and VMware, installed Ubuntu, and explored CentOS. One of the most valuable aspects of this journey was learning and mastering the fundamental Linux commands. Below, I share these basics in a comprehensive guide.
1. Navigating the File System
pwd (Present Working Directory): Displays the full path of the current directory.
ls (List): Lists all files and directories in the current directory.
ls -l: Provides a detailed view.
ls -a: Includes hidden files.
cd (Change Directory): Moves you to a specific directory.Example: cd /path/to/directory.
2. Managing Files and Directories
touch: Creates an empty file.Example: touch filename.txt.
mkdir (Make Directory): Creates a new directory.Example: mkdir my_directory.
rm (Remove): Deletes files and directories.rm filename.txt: Deletes a file.rm -r my_directory: Deletes a directory and all its contents recursively.
cp (Copy): Copies files and directories.cp source_file.txt destination_directory/: Copies a file to the destination. cp -r source_directory/ destination_directory/: Copies a directory with all its contents.
领英推荐
mv (Move): Moves or renames files and directories.mv filename.txt /path/to/destination/: Moves a file to the specified location. mv oldname.txt newname.txt: Renames a file.
3. Viewing and Editing Files
cat : Displays the contents of a file. Example: cat filename.txt.
less: Views large files, allowing you to scroll through the content.
nano: Edits a file using the Nano text editor.Example: nano filename.txt.
vim: Edits a file using the Vim text editor.Example: vim filename.txt.
4. File Permissions
chmod (Change Mode): Changes file or directory permissions.Example: chmod u+x script.sh: Gives execute permission to the file's owner.
chown (Change Ownership): Changes the ownership of a file or directory. Example: chown user:group filename.txt.
5. System Monitoring and Information
top: Displays real-time system resource usage, including CPU and memory usage.
These commands form the foundation of working with Linux and provide powerful tools for managing files, directories, permissions, and system resources.