Skip to main content

Basic Commands in Unix/Linux: ls, cd, pwd, etc.

Basic Commands in Unix/Linux: ls, cd, pwd, etc. Basic Commands in Unix/Linux: ls, cd, pwd, etc.

Basic Commands in Unix/Linux: ls, cd, pwd, and more

1. ls: List Directory Contents

The ls command is used to list the contents of a directory. By default, it lists the contents of the current directory.

Syntax:

ls [options] [directory]

Common Options:

  • -l: Long listing format (includes file permissions, number of links, owner, group, size, and timestamp)
  • -a: Show all files, including hidden ones (those starting with a dot)
  • -h: Human-readable format (for sizes, e.g., KB, MB)

Example:

ls -lah

2. cd: Change Directory

The cd command allows you to navigate between directories.

Syntax:

cd [directory]

Examples:

  • To move to a subdirectory:
  • cd subdirectory_name
  • To go up one directory level:
  • cd ..
  • To return to the home directory:
  • cd ~

3. pwd: Print Working Directory

The pwd command prints the full path of the current working directory.

Syntax:

pwd

Example:

pwd

4. mkdir: Make Directory

The mkdir command creates a new directory.

Syntax:

mkdir [options] directory_name

Common Options:

  • -p: Create parent directories as needed

Example:

mkdir -p parent_directory/subdirectory

5. rmdir: Remove Directory

The rmdir command removes an empty directory.

Syntax:

rmdir [directory]

Example:

rmdir empty_directory

6. rm: Remove Files or Directories

The rm command is used to remove files or directories.

Syntax:

rm [options] file_or_directory

Common Options:

  • -r: Remove directories and their contents recursively
  • -f: Force removal without prompting for confirmation

Example:

rm -rf directory_to_remove

Comments

Popular posts from this blog

Configuring Network Interfaces

Configuring Network Interfaces Configuring Network Interfaces Configuring network interfaces is a critical task for both system administrators and enthusiasts looking to optimize the performance and security of their networked devices. Network interfaces are the gateways that connect a device to a network, whether it's a local area network (LAN), wide area network (WAN), or the internet. This article will delve into the essential steps and considerations for configuring network interfaces across various operating systems and environments. Understanding Network Interfaces A network interface can be either physical, like an Ethernet port, or virtual, like those used in virtual machines or containers. Each network interface has a unique Media Access Control (MAC) address and can be assigned an IP address. Proper configuration ensures efficient data transmission, network security, and optimal performance. Steps to Config...

ACLs: Access Control Lists

ACLs: Access Control Lists ACLs: Access Control Lists Introduction Access Control Lists (ACLs) are a fundamental aspect of network security and management, crucial for ensuring that only authorized users have access to specific resources within a network. As networks become more complex, ACLs serve as a vital tool for administrators to control the flow of traffic and enforce security policies. What Are ACLs? An Access Control List is a set of rules that dictate what kind of traffic is allowed to enter or exit a network. These rules are applied to network devices such as routers and switches to control the movement of data packets. Each rule within an ACL specifies whether to permit or deny traffic based on criteria such as source and destination IP addresses, protocol types, and port numbers. Types of ACLs Standard ACLs These ACLs filter traffic based only on the source IP address. They are simpler bu...

Understanding IP Addressing and Subnetting

Understanding IP Addressing and Subnetting Understanding IP Addressing and Subnetting by Linux Playground What is an IP Address? An Internet Protocol (IP) address is a unique numerical identifier assigned to each device connected to a network that uses the Internet Protocol for communication. Think of it as the digital equivalent of a home address, guiding data packets to their destination. Types of IP Addresses IPv4 (Internet Protocol version 4): Consists of 32 bits, divided into four octets. Commonly represented as dotted-decimal notation (e.g., 192.168.1.1). Supports approximately 4.3 billion unique addresses. IPv6 (Internet Protocol version 6): Introduced to address IPv4 exhaustion. Consists of 128 bits, divided into eight groups of hexadecimal digits (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). Suppo...