BMClogo

A terminal (on MAC/Linux) or a command prompt (on Windows) is a powerful tool that allows you to interact with your computer using text commands instead of clicking on a graphical interface. While it may seem daunting at first, mastering basic terminal commands can help you:

  • Browse files and folders more efficiently
  • Execute tasks that cannot be executed through regular interfaces
  • Automatically repeat tasks
  • Have a deeper understanding of how computers work

This guide will introduce you to basic commands and concepts, regardless of the operating system you use.

getting Started

Open the terminal

On Windows:

  • Press WIN + R, type CMD, and press Enter
  • Or search for “Command Prompt” in the Start Menu

On Mac:

  • Press Command + Space to turn on the spotlight, type “Terminal”, and press Enter
  • Or find Terminal → Utilities → Terminal in the application

On Linux:

  • Press CTRL + ALT + T (on most distributions)
  • Or search for “Terminal” in the application menu

Understand the tips

When you first open the terminal, you will see a prompt that looks like this:

  • Windows: c:\ users \ yourusername>
  • MAC/Linux: Username@Computer: ~$

This tells you:

  • Your current location in the file system
  • Where to enter the command
  • On Mac/Linux, the ~ symbol represents your home directory

Basic navigation commands

View your current location

Windows: CD

MAC/Linux: PWD (Print working directory)

example:

List files and directories

Windows: dir

MAC/Linux: LS

example:

Options:

  • LS -L – List with details (file size, date of modification, permissions))
  • LS -A – Show hidden files (files starting with DOT)
  • LS -LA – Combining two options

Change Directory

All Platforms: CD DirectoryName

Example:

Create a directory

All Platforms: mkdir directory name

example:

Create a file

Windows: Type nul> filename.txt

MAC/Linux: Touch filename.txt

example:

Use files

View file content

Windows: Type filename.txt

MAC/Linux: cat fileName.txt

For larger files:

Windows: More fileName.txt

MAC/Linux: Less filename.txt (exit with Q)

Copy the file

Windows: Copy the source target

MAC/Linux: CP source target

example:

Move/rename files

Windows: Mobile source target

MAC/Linux: MV source target

Example:

Delete files and directories

Windows:

MAC/Linux:

⚠️Warning: Please be very careful to delete the command, especially RM -RWhen using the terminal, there is no “recycling bin” or “garbage” – the deletion is permanent.

Helpful tips

Command History

  • Press the up arrow to loop through the commands you used previously
  • On Mac/Linux, type history to view the latest command list

Tab completion

  • Start typing a file or directory name and press the tab
  • The terminal will try to complete it for you
  • If there are multiple options, press the tab twice to see all possibilities

Get help

Windows: Help command or command/?

MAC/Linux: MAN command (manual page, press Q to exit)

Example:

Clear the screen

Windows: CLS

MAC/Linux: Clear or CTRL+L.

Power User Command

Search for files

Windows: dir /s file name

MAC/Linux: Looking for. – Name File Name

Search in files

Windows: Find the “text” file name

MAC/Linux: GREP “text” file name

Chain Command

All Platforms: Run commands in order using &&

example:

Redirect output

All Platforms: Use > Send output to file

example:

Next step

When you become more satisfied with these basic commands, you may need to explore:

  1. Command line text editors such as Nano, VIM or Emacs
  2. Write simple shell scripts to automate tasks
  3. Packaging managers like APT (Linux), Homebrew (Mac), or Chocolate (Windows)
  4. Environment variables and how to set them
  5. SSH connection to remote computer

Common Errors and Troubleshooting

  1. Command not found: Check spelling or make sure the command is available on the system
  2. permission denied: You may need administrator/root privileges
    • Windows: Run command prompts as administrator
    • MAC/Linux: Use sudo before commands that require raising privileges
  3. No such file or directory: Double check path and file name
  4. Operation not allowed: Similar to denying permission, you may need special permissions
Task Windows MAC/Linux
Current location CD PWD
List file dir LS
Change Directory CD DIR CD DIR
Create a directory It’s MK It’s MK
Create a file Type nul>File Touch the file
Copy the file Copy the source target CP source target
Move/rename Mobile source target MV source target
Delete files document RM file
Delete Directory rmdir /s dir RM -R dir
Clear the screen CLS Clear
Get help Help command Man order

in conclusion

In this tutorial, we introduce everything that beginners need to know about using a terminal. We explored how to navigate across different operating systems, navigate file systems, create and manage files and directories, and open a terminal using the required commands. We also learned useful shortcuts, power user commands, and troubleshooting tips. With these basic skills, you can now confidently use the command line as a powerful tool in the calculation process.

Remember that terminals are a powerful tool for rewarding practices and experiments. Don’t be afraid to try new commands, but always be careful about modifying or deleting files’ commands.


Also, please stay tuned for us twitter And don’t forget to join us 85k+ ml reddit.

🔥 (Register now) Open Source AI’s Minicon Virtual Conference: Free Registration + Attendance Certificate + 3-hour Short Event (April 12, 9am to 12pm)


Nikhil is an intern consultant at Marktechpost. He is studying for a comprehensive material degree in integrated materials at the Haragpur Indian Technical College. Nikhil is an AI/ML enthusiast and has been studying applications in fields such as biomaterials and biomedical sciences. He has a strong background in materials science, and he is exploring new advancements and creating opportunities for contribution.

Source link