Mustafa CavusogluMC

Command Palette

Search for a command to run...

AboutExperiencesProjects
Linux3Docker7Git4Kubernetes7Network2uv1Miniconda1OpenShift4
Back to Home
Linux

Essential commands for file and directory management in Linux

filesdirectoriespermissionsbasic

Linux File Operations

Essential commands for managing files and directories in Linux.

Listing Files

# List files in current directory
ls

# List with details (permissions, size, date)
ls -la

# List with human-readable sizes
ls -lh

# List sorted by modification time
ls -lt

Creating and Removing

# Create a directory
mkdir my-folder

# Create nested directories
mkdir -p path/to/nested/folder

# Create an empty file
touch newfile.txt

# Remove a file
rm file.txt

# Remove a directory recursively
rm -rf directory/

Copying and Moving

# Copy a file
cp source.txt destination.txt

# Copy a directory recursively
cp -r source-dir/ destination-dir/

# Move or rename
mv oldname.txt newname.txt
mv file.txt /new/location/

File Permissions

# Change permissions (read, write, execute)
chmod 755 script.sh
chmod +x script.sh

# Change ownership
chown user:group file.txt

# Change ownership recursively
chown -R user:group directory/