Shell Tips

From WikiDLXTV
Revision as of 04:58, 20 March 2010 by Asfaltboy (Talk | contribs) (Added Shell Tips)

Jump to: navigation, search

<<Page in construction>>

Common Shell Commands

I've put together some of the useful shell commands that are available under WDLXTV (using SSH or Telnet). They're organized alphabetically, so you can easily find a command, their description and how to use it. This guide will continue to be updated and if you would like to add to this guide, please edit after checking the command yourself.

  • ls : list files/directories in a directory, comparable to dir in windows/dos.
ls -al : shows all files (including ones that start with a period), directories, and details attributes for each file.
  • cd : change directory (ex: cd /usr/local/apache will go to /usr/local/apache/)
cd ~ : go to your home directory
cd - : go to the last directory you were in
cd .. : go up a directory
  • cat : print file contents to the screen (ex: cat filename.txt : cat the contents of filename.txt to your screen)
more : like cat, but opens the file one screen at a time rather than all at once (browse through the file, hit Space to go to the next page, q to quit)
tail : like cat, but only reads the end of the file. ex:
tail /var/log/messages : see the last 20 (by default) lines of /var/log/messages
tail -f /var/log/messages : watch the file continuously, while it's being updated
tail -200 /var/log/messages : print the last 200 lines of the file to the screen
  • chmod : changes file access permissions. (usage: chmod permissions filename)
Permission Table
# permission meaning
0 --- No permission
1 --X Execute only
2 -W- Write only
3 -WX Write and execute
4 R-- Read only
5 R-X Read and execute
6 RW- Read and write
7 RWX Read, write and execute
  • The permission is a set of 3 numbers in this order from left to right: USER - GROUP - EVERONE. The three digits can be 0-7 as shown in the table on the right:
ex: chmod 000 file1 means No one can access file1, chmod 777 file2 means Anyone can access /write to/execute file2
  • chown : changes file ownership permissions. The permission set is of 2 parameters going from left to right: USER.GROUP (ex: chown root myfile.txt : Changes the owner of the file to root, chown root.root myfile.txt : Changes the owner and group of the file to root)