Navigation

Change to the specified directory.

$ cd directory_name

Go back to the parent directory.

$ cd ..

Print the current working directory.

$ pwd

Push the current directory onto the stack and change to the specified directory.

$ pushd directory_name

Pop the top directory from the stack and change to it.

$ popd

Change to the home directory.

$ cd ~

Change to the previous directory.

$ cd -

Change to the root directory.

$ cd /

Listing

List all files in the current directory.

$ ls

List files in long format with detailed information.

$ ls -l

List all files, including hidden ones.

$ ls -a

List files with human-readable file sizes.

$ ls -lh

List subdirectories recursively.

$ ls -R

List files sorted by modification time.

$ ls -lt

List only directories in the current directory.

$ ls -ld */

List files and directories in a tree-like format.

$ tree

Creation and Removal

Create a new directory with the specified name.

$ mkdir directory_name

Remove an empty directory.

$ rmdir directory_name

Create an empty file named 'file.txt'.

$ touch file.txt

Remove (delete) a file.

$ rm file.txt

Remove a directory and its contents recursively.

$ rm -r directory_name

Move (rename) files or directories.

$ mv source destination

Copy files or directories.

$ cp source destination

Copy directories recursively.

$ cp -r source destination

Permission and Ownership

Change file permissions (e.g., chmod 755 file).

$ chmod permissions file

Change the owner and group of a file.

$ chown user:group file

Change the group of a file.

$ chgrp group_name file

Display or set the file creation mask.

$ umask

Execute a command with superuser privileges.

$ sudo

Switch user or become superuser.

$ su

Repeat the last command with superuser privileges.

$ sudo !!

Run a command as another user.

$ sudo -u username command

Archives and Compression

Create a compressed tarball of a directory.

$ tar -czvf archive.tar.gz directory

Extract files from a compressed tarball.

$ tar -xzvf archive.tar.gz

Extract files from a ZIP archive.

$ unzip archive.zip

Compress a file with gzip.

$ gzip file

Decompress a gzip-compressed file.

$ gunzip file.gz

Compress a file with bzip2.

$ bzip2 file

Decompress a bzip2-compressed file.

$ bunzip2 file.bz2

Create a 7-Zip archive of a directory.

$ 7z a archive.7z directory

Moving (Renaming) Files

Rename a file.

$ mv old_filename new_filename

Move a file to a different directory.

$ mv filename destination_directory

Removing (Deleting) Files

Remove (delete) a file.

$ rm filename

Remove a directory and its contents.

$ rm -r directory_name

Viewing File Contents

Display the contents of a file.

$ cat filename

View the contents of a file with more control.

$ less filename

Editing Files

Edit a file using the nano text editor.

$ nano filename

Finding Files

Search for a file in a specific path.

$ find /path/to/search -name "filename"

Network commands

Test Network Connection.

$ ping

Display IP Configuration.

$ ipconfig

Trace Route to Destination.

$ tracert

Display Network Statistics.

$ netstat

Query DNS for Information.

$ nslookup

Display or Modify the ARP Cache.

$ arp

Display or Modify the Routing Table.

$ route

Connect to a Remote Host.

$ telnet

System Information Commands

Detailed system configuration information.

$ systeminfo

Display current Windows version.

$ ver

List running processes details.

$ tasklist

Display Network Statistics.

$ taskkill

Display current user information.

$ whoami

Retrieve system boot time..

$ systeminfo

Open System Information utility.

$ msinfo32

List installed device drivers details.

$ driverquery

Output and Formatting Commands

Display messages or enable/disable echoing.

$ echo

Clear the command prompt screen.

$ cls

Display output one screen at a time.

$ more

Display the content of a file.

$ type

Turn off command echoing.

$ echo off

Turn on command echoing.

$ echo on

Change console color attributes.

$ color

Configure system devices and ports.

$ mode

User Account Commands

Display or modify user accounts.

$ net user

Display or modify group membership.

$ net group

Display current user and group.

$ whoami

Add a new user account.

$ net user [username] [password] /add

Delete a user account.

$ net user [username] /delete

Add user to local administrators.

$ net localgroup administrators /add [username]

Remove user from local administrators.

$ net localgroup administrators /delete [username]

Display account policies.

$ net accounts

Security and Permissions

Display or modify ACLs.

$ cacls

Display or modify ACLs (enhanced).

$ icacls

Encrypt or decrypt files/folders.

$ cipher

Take ownership of files/folders.

$ takeown

Grant specific permissions.

$ icacls [path] /grant [user:permission]

Deny specific permissions.

$ icacls [path] /deny [user:permission]

Remove user's permissions.

$ icacls [path] /remove [user]

Scan and repair system files.

$ sfc /scannow

Security and Permissions

Check disk for errors.

$ chkdsk

System File Checker.

$ sfc

Update Group Policy.

$ gpupdate

Shutdown or restart the computer.

$ shutdown

Configure power settings.

$ powercfg

Create, delete, configure scheduled tasks.

$ schtasks

Manage Boot Configuration Data.

$ bcdedit

Disk Partitioning Tool.

$ diskpart

System Utilities

Check disk for errors.

$ chkdsk

System File Checker.

$ sfc

Update Group Policy.

$ gpupdate

Shutdown or restart the computer.

$ shutdown

Configure power settings.

$ powercfg

Create, delete, configure scheduled tasks.

$ schtasks

Manage Boot Configuration Data.

$ bcdedit

Disk Partitioning Tool.

$ diskpart

Task Scheduler

Create, delete, configure scheduled tasks.

$ schtasks

Schedule commands and programs.

$ at

Delay execution for a specified time.

$ timeout

Display a list of tasks.

$ schtasks /query

Run a scheduled task immediately.

$ schtasks /run

End a running task.

$ schtasks /end

Delete a scheduled task.

$ schtasks /delete

Change properties of a task.

$ schtasks /change

I/O Redirection

Redirect command output to a file (overwrite).

$ command > output_file

Redirect command output to a file (append).

$ command >> output_file

Redirect command input from a file.

$ command < input_file

Redirect error output to a file.

$ command 2> error_file

Redirect both standard output and error output to a file.

$ command 2>&1 > output_file

Redirect command output to a file and also display it in the terminal.

$ command | tee output_file

Append command output to a file and also display it in the terminal.

$ command | tee -a output_file

Redirect both input and output using file descriptors.

$ command < input_file > output_file

Tail Command

Display the last 10 lines of a file.

$ tail file.txt

Display the last N lines of a file.

$ tail -n N file.txt

Output appended data as the file grows (follow).

$ tail -f file.txt

Display the last N bytes of a file.

$ tail -c N file.txt

Quiet mode, display the last N lines without header.

$ tail -q -n N file.txt

Always display headers.

$ tail -v file.txt

Display starting from line N.

$ tail -n +N file.txt

Terminate after process ID (PID) dies.

$ tail --pid=PID -n 1 -f file.txt