Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views2 pages

Linux Commands Cheat Sheet

This document is a cheat sheet for basic Linux commands, covering file management, permissions, and process management. It includes commands for navigating directories, manipulating files, and managing processes with examples. The cheat sheet serves as a quick reference for users to efficiently use Linux commands.

Uploaded by

ussopsemail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Linux Commands Cheat Sheet

This document is a cheat sheet for basic Linux commands, covering file management, permissions, and process management. It includes commands for navigating directories, manipulating files, and managing processes with examples. The cheat sheet serves as a quick reference for users to efficiently use Linux commands.

Uploaded by

ussopsemail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux Commands Cheat Sheet

Basic Commands

pwd # Print working directory.

ls # List files and directories.

ls -a # Include hidden files.

ls -l # Long listing format.

cd [path] # Change directory.

cd .. # Go up one directory level.

cd ~ # Go to the home directory.

mkdir [dir] # Create a new directory.

rmdir [dir] # Remove an empty directory.

rm [file] # Remove a file.

rm -r [dir] # Remove a directory and its contents.

touch [file] # Create an empty file.

cp [source] [destination] # Copy files or directories.

cp -r # Copy directories.

mv [source] [destination] # Move or rename files/directories.

cat [file] # View file contents.

less [file] # View file contents one page at a time.

head -n [number] [file] # View the first n lines of a file.

tail -n [number] [file] # View the last n lines of a file.

file [file] # Determine the file type.

File Permissions

ls -l # View file permissions.

chmod [permissions] [file] # Change file permissions.

# Example: chmod 755 file

# 7 = read, write, execute (owner)

# 5 = read, execute (group)

# 5 = read, execute (others)


Linux Commands Cheat Sheet

chown [owner]:[group] [file] # Change file ownership.

chgrp [group] [file] # Change group ownership of a file.

umask # Set default file creation permissions.

stat [file] # View file status including size, permissions, and

timestamps.

Process Management

ps # Display running processes.

ps aux # Detailed process list.

top or htop # Monitor processes in real time.

kill [PID] # Terminate a process by PID.

kill -9 [PID] # Force kill a process.

jobs # List background jobs.

fg [job] # Bring a background job to the foreground.

bg [job] # Resume a job in the background.

nice [priority] [command] # Run a command with a specified priority.

renice [priority] [PID] # Change the priority of a running process.

nohup [command] # Run a command immune to hangups.

pstree # Show a tree of processes.

You might also like