Useful Linux Commands


Detailed processes: ps aux

Kill process: kill [PID]

Users and Groups

Shows users: less /etc/passwd

Creates user with password: useradd [NAME] -p [PASSWORD]

Changes password: passwd [USER]

Lock account: passwd -l [USER]

Unock account: passwd -u [USER]

Changes name of account: usermod -l [NEWNAME] [USERNAME]

Shows groups: less /etc/group

Creates group: groupadd [NAME]

Deletes group: groupdel [NAME]

Adds user to group: usermod -G [GROUP] [USER]

File Permissions

Shows permissions in ###: umask [FILE]

Changes owner: chown [USER] [FILE]

Changes group: chown [GROUP] [FILE]

Changes Permissions (### = permissions, for example 777=rwxrwxrwx): chmod ### [FILE]

Maxes executable: chmod +x [FILE]

Maintaining Drives

Shows drives: df

Mounts device: mount -t [file system] [device] [location]

Unmounts device: umount [device]

Shows drives in detail that get automatically mounted: less fstab

Makes file system: mkfs -t [file system] [device]

Shows contents of the drive: du -cah

Fix Filesystem: /sbin/fsch [device]

Scheduled jobs list: crontab -l

Add to crontab job (options min, hour, day, month, weekly): crontab -e [option]

Listings and Navigation

Detailed list: ls -l

List hidden: ls -a

List Recursive: ls -R

This directory: ./

Parent directory: ../

Go home: cd ~

Show absolute path: pwd

Preview file’s content: cat [file]

Sync files together: cat [file1] [file2]

Redirects file to act as input for cat command: cat < [file]

Write text to the end of file: echo ‘text’ >> [file]

Overwrite file with text: echo ‘text’ > [file]

Find (option: only dirs: -type d, no dirs: -f): find [path] [option] [‘string’]

Updates database for locate: update db

Displays usernames in first colon-delimited field: cat -d: -f1 /etc/passwd

Search for string and display lines that contain them: grep [‘string’] [file]

Displays first ten lines: head [file]

Displays last ten lines: tail [file]

Locate binary, source or man: whereis [options] [file]

Path for command executable: which [command]


View variable ID: echo $[var]

Export var for child sessions: export [var]

Display set vars: set

Remove var: unset [var]

Create user defined var: [var] = [value]


Lists modules: lsmod

Install into kernel: insmod [module]

Removes: rmmod [module]

Install module: modprobe [module]

Remove module: modprobe -r [module]

Ubuntu – How to allow root user

sudo passwd root

sudo gedit /etc/gdm/gdm.conf

AllowRoot = true

Setting the scrolling for mouse coordinates

synclient -m 1

synclient RightEdge = [number]


CPU Frequency Scaling: cat /sys/devices/system/cpu0/cpufreq/scaling_available_frequencies

CPU Frequency Modes: cat /sys/devices/system/cpu0/cpufreq/scaling_available_govenors

Graphic corruption at startup for ATI graphic cards

aticonfig –initial -f

Convert RPM to DEB package

sudo aptitude install alien

sudo alien -c [RPM]

Leave a Reply