Linux commands cheatsheet

Standard

linux command line

System Management

  • Restart the machine:

  • Shutdown the machine:

User Management:  How do I add a new user in Linux?

Without a home directory

With home directory

Then set the password

Then set the shell

Disk Management: How much disk space left on Linux machine?

  • Checking for disk space on available volumes:

Check for size of folders in current working directory:

 

App Management: How do I install new software in Linux?

Install new software in Debian / Ubuntu Linux

Install new software in  Gentoo Linux

Install software from source

Install rpm packages

Filesystem: Basics

Create a directory in Linux

Remove a directory in Linux

List files in directory

Enter a directory

Up a directory

Execute a program

 

Filesystem: How do I compress/decompress files?

Create .tar.gz / .tgz files:

Extract .tar.gz / .tgz files:

Create .zip files:

Extract .zip files to directory:

Watch a log file real-time:

Find files containing text:

Download a file from the internet:

Back up your stuff locally:

Back up your stuff to another server:

 

File Permissions

Make a file executable:

Environment variables

Inspect the current PATH variables:

Append directory to the existing

Declare a new environment variable:

Edit system-wide environment variables:

Create an alias for a command:

Process Management

Kill a process:

See all running processes:

Get PIDs of running processes under a specific name:

 

Anytime a process stops, start it

Machine Properties

Modify the host name:

Set a static IP address:

Modify hosts:

Cron Jobs

Check existing cron jobs:

Networking

What IP adress is assiged to me?

What TCP/IP ports are open and what programs are listening on them?

(needs to have lsof installed and be run as root)

Where do I configure my network interfaces?

then run ifdown and then ifup

What are the details of a specific network interface?

Connect to a specific wireless network for a given interface?

Get an IP address assigned from a router?

How do I list all NAT rules?

What are all of the available network devices for this machine?

Filesystem Management

View available files systems on your machine:

Write a new file system to a device  (DANGEROUS!)

Check for bad blocks on a device

Force creating a file system on a new device

Set volume label

Partition Management

Manipulate partition table

Manipulate partition table (gui)

Show disk information, display attributes of a physical volume. This will output interesting information about your partitions.

Creates a volume group descriptor at the start of the /dev/hdb1 partition.

Resize logical volume

Destroy partition table of your disk (VERY DANGEROUS)

Uncategorized

Leave a Reply