basic-linux-commands

Learn Basic Linux Commands and Terminology Now !!

This part is the 3 of 4 in the series Linux Basics For Hackers
Series Navigation<< A Short Tour of Kali Linux In 10 minUnderstand The Linux Filesystem >>

Before starting anything we should at least have an idea of how we can navigate through the Linux filesystem right? In this part, we will learn to navigate through folders and directories in a Linux terminal using various commands like cd ls etc… Let’s go!! 😆

Mastering the cd Command: Your Teleportation Device

The cd command, short for “change directory,” is your key to exploring different locations within the Linux file system. Here’s a breakdown of some commonly used variations:

  • cd <directory name>: This is the bread and butter of navigation. Replace <directory name> with the actual directory you want to move into. For example, cd Documents will take you to your Documents folder.
  • cd ..: Want to go back one level in the directory structure? This handy shortcut lets you do just that. Imagine you’re in a subfolder within your Downloads directory. Typing cd .. will move you back to the Downloads directory itself.
  • cd -: Feeling lost? This command teleports you back to the previous directory you were in. Think of it like a back button for your file system exploration.
  • cd ~: This takes you straight to your home directory, no matter where you are in the file system. It’s like a shortcut to your personal space within the Linux system.
  • cd /: This one takes you to the root directory, the topmost level of the entire file system. It’s like being at the starting point of a giant family tree, with all other directories branching out from here.

Remember: With cd, the directory name you specify is always relative to your current location.

Home and Root Directories

  • Home Directory: Every user in Linux has their own home directory, which acts as their personal storage space. This is where you’ll typically find your documents, downloads, and other user-specific files. The cd ~ command, as mentioned earlier, is a quick way to access your home directory. It’s just the user’s directory, similar to Windows where you have a downloads folder, documents folder, picture folder and so on…
  • Root Directory: Imagine a giant tree. The root, the very foundation from which the entire tree grows, represents the root directory in Linux. Denoted by a forward slash (/), it serves as the starting point for the entire file system. Every other directory on your system – from your personal documents to the operating system itself – branches out from this central root, forming a well-organized hierarchy. The cd / command is used to go to your root directory.

Find Files and Folders Present in a Directory using ls

The ls command, short for “list”, is used to list files and folders present in a directory. Here are some ways to utilize it effectively:

  • ls: This basic command lists the names of all files and subdirectories within your current directory.
  • ls -l: Want more details? The -l (long) option provides a detailed listing, including file permissions, owner, group, size, and last modification date.
  • ls -la: This displays all files, including hidden ones (which typically start with a dot) along with the detailed listing provided by -l.
  • ls -lh: Sometimes, file sizes can be daunting to interpret. The -h (human-readable) option displays sizes in a more user-friendly format, such as kilobytes (KB) or megabytes (MB), instead of raw bytes.

By effectively using these basic commands, you’ll be well on your way to navigating the Linux file system with confidence. Remember, practice makes perfect! So, open up a terminal and start exploring! and, ya I know I said, the next part will be on FileSystem but I thought first you should know how to navigate through the filesystem itself.