Linux Mint Ubuntu Cheat Sheet
Linux Mint Ubuntu Cheat Sheet
com
Navigation:
cd – change directory
cp –avr <path to source directory/file> <path to destination directory/file> - copy directory / file
Viewing:
less <path to file> - view contents of a file (screen full at a time with option to scroll backwards)
nano <path to file> - create and open / open file for editing in nano text editor
vi <path to file> - create and open / open file for editing in vi text editor
tail –f <path to file> - view last 10 lines of a changing file (usually a log file) in real time
watch <linux command> - watch the output of a command (refreshes every 2 seconds by default)
File Permissions:
chmod 777 <path to file> - Owner, group users and other users can read, write and execute the file.
chmod 700 <path to file> - Owner can read, write and execute the file. Group users and other users do not have any
permission for the file.
chmod 666 <path to file> - All users can read and write to the file.
chmod 644 <path to file> - Owner can read and write to the file. Group users and others can only read the file.
For more Linux tips and tricks visit - http://ihaveapc.com/category/linux/
Linux Mint / Ubuntu Cheat Sheet www.ihaveapc.com
Folder Permissions:
r (read) – Allows user to list the files in the directory – numerical value = 4
w (write) – Allows user to create new files and delete the files in the directory – numerical value = 2
x (execute) – Allows user to change to the directory via cd command – numerical value = 1
chmod 777 <path to folder> - Allows owner, group members and others to list files in directory, create files in
directory, delete files from the directory and to change to the directory.
chmod 755 <path to folder> - Allows owner to list files in directory, create files in directory, delete files from the
directory and to change to the directory. Group members and others can change to the directory and list the files only.
chmod 700 <path to folder> - Allows owner to list files in directory, create files in directory, delete files from the
directory and to change to the directory. Group members and others do not have any permission on the directory. This
makes the directory private to the owner.
User Management:
deluser <existing user name> - remove a user without removing user’s home directory
deluser <existing user name> -remove-home – remove a user with user’s home directory
useradd –g <group name> <user name> - add user to a group, group specified will be user’s primary group
useradd –G <group name> <user name> - add user to a group, group specified will be user’s secondary group
System:
echo $SHELL - displays the current Linux Mint/Ubuntu shell being used (bash by default)
top - real-time information about Linux system uptime, number of users, system load, number of tasks, and utilization
of system resources
uname –a - name, kernel version, machine type, network node host name, processor type, OS release, OS version and
other system architecture details
lsb_release –a - LSB version, distributor ID, description of distribution, release number and codename of the
distribution
lshal – lists all the devices that HAL(Hardware Abstraction Layer) is aware about i.e. most of the hardware connected to
your system
lshw – lists hardware present in the system including information about manufacturer, device type and where it is
connected
Networking:
ping <website/ip address> - to test connectivity or response from a particular IP address or website
Installation:
./configure
make
make install
Search:
locate <file name> - search the system for the specified file name
Linux command | grep <pattern> - searches the output of the command for the specified pattern
which <command> - shows the executable which would be run by default for executing the command
Compression:
tar –czvf <archive name>.tar.gz <file name 1> <file name 2>…<file name n> - create a tarball by compressing the
specified files
tar –cf <archive name>.tar <file name 1> <file name 2>…<file name n> - create a tar archive by compressing the
specified files
gzip <file name> - compresses a file and creates a gzip archive called <file name>.gz
Power: