There was a problem loading the comments.

List of Basic LINUX Commands

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

ls - Lists files/folders within a directory.
ll - Lists files/folders within a directory and shows the full details such as owners, modified date, permissions, etc.

df - Shows the servers hard drive information and partitions if necessary. Also shows the mount point, used disk space and available disk space.
df -h - Same as above except shows the numbers in GB/MB.

cd - Changes directory. Example: cd /usr/local/apache/sites/
cd .. - Takes you back one directory. So if you used the command above and were in /sites and then ran (cd ..) you would be taken back to /apache.

touch filename - This will create a file, not a directory. Example: touch hello.php
mkdir directoryname - This will create a directory, not a file. Example: mkdir images

find /*directory* -iname *.pdf - This will find a specific file or all files with a specific extension.  Fill in the directory in *directory* or just leave it blank to search the whole server.  -iname will yield whatever.pdf, whatever.Pdf, etc.


free - Shows memory usage details for the server.
top - Shows running processes as well as CPU usage, memory usage, concurrent connections and more. Running this command is a resource hog so only use when necessary.

/etc/init.d/httpd start/stop/restart - This will start, stop or restart the Apache web server. This same command can be used for other services on the server. Simply change the (httpd) to any other service name such as:

vsftpd
mysqld
dovecot
sendmail

ethtool eth0 - Will check the port speed on the ethernet card.


** CAUTION WITH THIS NEXT SET OF COMMANDS! **

rm filename - Will remove a file. When this command is issued you will be asked to confirm. This can be used for files or directories. (y = yes, n = no)
rm -rf filename - Does what the command above does except no confirm. The (-rf) forces the deletion. You will not be asked to confirm. This can be used for files or directories.

** CAUTION WITH THIS NEXT SET OF COMMANDS! **

mv filename - This will rename a file or directory name. Example 1: mv filename.php newfilename.php Example 2: mv directoryname/ newdirectory name
mv filename /to/new/location - This will move a file or directory to a new location.


Share via

Related Articles


Self-Hosted Help Desk Software by SupportPal
© Way3 Hosting