Pengenalan CLI - 1 Pengenalan Shell dan Terminal
Table of Contents
Introduction
This tutorial introduces the Command Line Interface (CLI), specifically focusing on the Shell and Terminal. Understanding these tools is essential for anyone looking to enhance their computing skills, automate tasks, or develop software efficiently. By the end of this guide, you'll have a foundational grasp of what the Shell and Terminal are and how to use them effectively.
Step 1: Understanding the Shell and Terminal
- Definition of Shell: The Shell acts as an interface between the user and the operating system, allowing you to execute commands and manage files.
- Definition of Terminal: The Terminal is a program that provides access to the Shell. It displays the command line prompt, where you can input commands.
- Importance: Knowing how to navigate the Shell can greatly increase your productivity and control over your system.
Step 2: Accessing the Terminal
- Windows:
- Open the Command Prompt by searching for "cmd" in the Start menu.
- Mac:
- Open the Terminal app found in Applications > Utilities.
- Linux:
- Search for "Terminal" in your application menu or use the shortcut
Ctrl + Alt + T
.
- Search for "Terminal" in your application menu or use the shortcut
Step 3: Basic Commands
Familiarize yourself with some fundamental commands to get started.
- Listing files:
- Use
ls
(Mac/Linux) ordir
(Windows) to display files in the current directory.
- Use
- Changing directories:
- Use
cd [directory_name]
to navigate to a specific folder.
- Use
- Creating a directory:
- Use
mkdir [directory_name]
to create a new folder.
- Use
- Removing a file:
- Use
rm [file_name]
(Mac/Linux) ordel [file_name]
(Windows) to delete a file.
- Use
Step 4: Navigating the File System
- Current Directory: Use the command
pwd
(Mac/Linux) to print the working directory. - Relative vs Absolute Paths:
- Relative Path: Refers to a location relative to the current directory (e.g.,
cd ../folder_name
). - Absolute Path: Specifies the complete path from the root (e.g.,
cd /Users/username/folder_name
on Mac/Linux).
- Relative Path: Refers to a location relative to the current directory (e.g.,
Step 5: Using Command Options
- Many commands have options or flags to modify their behavior.
- Example:
ls -l
provides a detailed list of files.
- Learn how to combine commands using the
&&
operator:- Example:
mkdir new_folder && cd new_folder
creates a new folder and navigates into it.
- Example:
Step 6: Exiting the Terminal
- To exit, simply type
exit
and press Enter. This will close the Terminal window.
Conclusion
By understanding the basics of the Shell and Terminal, you can significantly enhance your computing experience. Practice the commands outlined in this tutorial to become comfortable navigating your system. As a next step, consider exploring more advanced commands and scripting to automate repetitive tasks, further boosting your efficiency.