Linux Commands

Last Update Unknown

Commands

Command Use
cd Changes your current directory
pwd Print the Working Directory
mkdir Make a new directory
rmdir Remove a directory
rm Delete a file
rm -rf This deletes all files and directories in the data directory, including the data directory itself
ls Shows you the contents of the current working directory
ls -a Use the option "-a" to see the hidden files such as ones beginning with a "." character
ls -l Use the "-l" option to see a long listing of a file. Shows file permissions and the file size in bytes
cp Copy a file from one location to another
mv Move a file from one location to another. Can also be used to rename a file
cat Concatenate several files together
head Get the first x lines from the head (start) of a file or command output. e.g. 'head -1 /etc/passwd' would get one line from the start of the file /etc/passwd
tail Get the last x lines from the tail (end) of a file or command output.e.g. 'head -1 /etc/passwd' would get one line from the end of the file /etc/passwd
chmod Controls file permissions, allowing you to specify who can access files, search directories, and run scripts
file Determine the type of a file
md5sum Print or check MD5 (128-bit) checksum
cmp Compare the two files byte by byte
find Find files by type, content, name, age and more
grep Find or search a regular expression or string in a text file
egrep The grep command using extended regular expressions
wc Calculates a file's word, line, character, or byte count
du / Summarise disk usage. The -h flag can be used to get the answer in human readable format (such as 6.2M)
df / Shows information about the file system such as available disk space
id Print user and group information for the specified USER, or (when USER omitted) for the current user
chown Change the owner and/or group of each FILE to OWNER and/or GROUP
chgrp Change the group of each FILE to GROUP
vim Open a file in the Vim editor
cal cal command is used to view the calendar of a specific month or a whole year. For example, cal 08 2000, would retrieve the calendar for August 2000
ln Create links to files or directories. By default, creates a hard link (a mirror copy) of the file
ln -s Makes symbolic links instead of hard links. Soft links are links to the actual original file
ip route Routing Table Management
ip route add Add new route (e.g. ip route add default via 192.168.3.62 dev eth0)
ip address Protocol Address Management
ip address add Add new protocol address (e.g. ip address add 192.168.3.62/28 broadcast 192.168.3.63 dev eth3)
traceroute Print the route packets trace to network host
nmap Network exploration tool and security / port scanner
tcpdump Dump traffic on a network
netstat Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
getenforce Get the current mode of SELinux
sesearch Search the rules in a SELinux policy
semanage Semanage is used to configure certain elements of SELinux policy with-out requiring modification to or recompilation from policy source
which Write the full path of COMMAND(s) to standard output
ps Report a snapshot of the current processes
chcon Change the SELinux security context of each FILE to CONTEXT
touch Create a file without any content
matchpathcon Get the default SELinux security context for the specified path from the file contexts configuration
restorecon Restore file(s) default SELinux security contexts
getsebool Get SELinux boolean value(s)
setsebool Set SELinux boolean value(s)
systemctl Control the systemd system and service manager
systemctl start Start (activate) one or more units specified on the command line
systemctl status Show terse runtime status information about one or more units, followed by most recent log data from the journal
systemctl restart Restart one or more units specified on the command line. If the units are not running yet, they will be started
systemctl stop Stop (deactivate) one or more units specified on the command line
iptables Administration tool for IPv4/IPv6 packet filtering and NAT
route Show / manipulate the IP routing table
groupadd Create a new group
useradd Create a new user or update default new user information
ssh OpenSSH SSH client
diff Compare files line by line
alias Instructs the shell to replace one string with another string while executing the commands
sudo Execute a command as another user
hostname Show or set the system's host name
wget Used to download files from the Web
cut Remove sections from each line of files
sort Sort lines of text files
xargs Build and execute command lines from standard input