Linux Commands

File commands

cat > fileplaces standard input into file
cdchange to the home directory
cd directorychange directory to directory
cp file1 file2copy file1 to file2
head fileoutput the first 10 lines of file
ln -s file linkcreate symbolic link to file
lsdirectory listing
ls -alformatted directory listing of files (including hidden ones)
mkdir dircreate a directory called dir
more fileoutput the contents of file
mv file1 file2rename or move file1 to file2. If file2 is an existing directory, moves file1 into directory file2
pwdshow current directory
rm filedelete file
rm -f fileforce remove file
rm -r dirdelete directory dir
rm -rf dirforce remove directory dir — USE WITH EXTREME CAUTION
scp -r [email protected]:directory1 [email protected]:directory2recursively copies files between servers
tail fileoutput the last 10 lines of file
tail -f fileoutput the last 10 lines of file as it grows, starting with the last 10 lines
touch filecreate or update file

File Permissions

The owner, group and world permissions for files and directories can be changes using the chmod command

  • 4 – read (r)
  • 2 – write (w)
  • 1 – execute (x)


chmod 777 filechange permissions of file to read, write and execute for all
chmod 755 filechange permissions of file to rwx for owner, rx for group and world


grep pattern filessearch for pattern in files
grep -r pattern dirsearch recursively for pattern in dir
locate filefind all instances of file


dig domainget DNS information for domain
dig any @nameserver domainget DNS information for domain held by nameserver
dig mx domainget DNS mail information for domain
ping host/domainping host or domain and output results
whois domainget whois information for a domain


ssh [email protected]connect to host as user
ssh -p port [email protected]connect to host on port port as user
ssh -copy -d [email protected]add your key to host for user to enable a keyed or passwordless login


tar cf file.tar filescreate a tar named file.tar containing files
tar xf file.tar filesextract the files from file.tar
tar czf file.tar.gz filescreate a tar with Gzip compression
tar xzf file.tar.gz filesextract a tar using Gzip
tar cjf file.tar.bz2 filescreate a tar with Bzip2 compression
tar xjf file.tar.bz2 filesextract a tar using Bzip2
gzip filecompresses file and renames it file.gz
gzip -d file.gzdecompresses file.gz back to file


Ctrl+Chalts the current command
Ctrl+Zstops the current command, resume with fg in the foreground or bg in the background
Ctrl+Dlog out of the current session, similar to exit
Ctrl+Werases one word in the current line
Ctrl+Uerases the whole line
Rtype to bring up a recent command
 !!repeats the last command
exitlog out of the current session

System Info

uptimeshow current uptime
wshow who is online
whoamishow who you are logged in as
finger userdisplay information about user
uname -ashow kernel information
cat /proc/cpuinfoshow CPU information
cat /proc/meminfoshow memory information
man commandshow manual for command
dfshow disk usage
dushow directory space usage
freeshow memory and swap usage
whereis appshow possible locations of app
which appshow which app will be run by default
whoisshows the identity of a domain or IP address
locatefind file or directory

Hostway Linux commands

These commands only work for domains still on Begis

dom domaindisplay web and mail server information for domain
dom domain -fdisplay hosting features for domain
domm domaindisplay mailbox information for domain
paccount domaintools for managing quota/FrontPage/PHP/SSL/MySQL etc
sysadd server masteraccount masteraccountpasswordadds domain to a server
sysclone server domain masteraccount masteraccountpasswordcopies a domain from one Debian server to another
updateWhere domain newinternalservernamenotifies all of Hostway’s systems where the customer is now located
Scroll to top