Common FreeBSD Shell Commands

11
Dec
COMMAND LIST
cd [directory] The cd command changes your current working directory to the directory you specify.



Example: % cd ~/www/htdocs



DOS Equivalent: cd
pwd The pwd command prints your current (or present) working directory.



Example: % pwd



Usage: Simply type pwd and hit return to display your current working directory.
ls [directory] The ls command is used to list the file in the directory specified, or if you do not specify a directory, the current working directory. You can also add some additional arguments to customize the list display.




Usage: If you type ls -F it will append a forward slash to the subdirectory names so you can easily distinguish them from file names.


If you type ls -a it will show all hidden files. Hidden files begin with a dot (.), such as .htaccess files.



If you type ls -l it will show detailed information about each file and directory, including permissions, ownership, file size, and when the file was last modified.



You can also mix the arguments. If you type ls -aF you will see a list of all file names (including hidden files) and a forward slash will be appended to directory names.



DOS Equivalent: dir



Example: % ls -al

cat [filename] The cat command displays the contents of the filename you specify. If you want to display the file one screen at a time try cat [filename] | more or simply more [filename].



DOS Equivalent: type



Example: % cat ~/var/log/messages
mkdir [directory] The mkdir command makes a new directory with the name, directory, that you specify.



DOS Equivalent: md or mkdir



Example:
% mkdir myfiles

rmdir [directory] The rmdir command removes the directory that you specify.




DOS Equivalent: rd or rmdir



Example:
% rmdir myfiles

cp [source-file] [target-file] The cp command creates a copy of source-file with the name target-file. You can specify pathnames as part of the file specification. If target-file exists it is overwritten.


DOS Equivalent: copy



Example: % cp index.html ~/www/htdocs/index.html

mv [source-file] [target-file] The mv command renames a file or moves it to a new location. You can specify pathnames as part of the file specification. If target-file exists it is overwritten.



DOS Equivalent: rename



Example: % mv ~/www/htdocs/index.html ~/www/vhosts/mydomain/index.html
rm [filename] The rm command deletes (removes) a file. To remove a directory and eveyrthing inside, you can use the -r (recursive) flag (e.g. rm -r filename). You can specify pathnames as part of the file name specification.



DOS Equivalent: del



Example: % rm ~/www/htdocs/old-index.html
grep [pattern] [filenames] The grep command finds lines in files that match specified text patterns. You can specify pathnames as part of the file specification. For example if you want to search for the pattern gif in all html files in your current working directory, you would type grep gif *.html and hit return. The grep command would then list all occurrences of gif it finds in .html files in the current working directory.



DOS Equivalent: find



Example: % grep href *.html

tar [options] [tarfile] [files] The tar command copies a file or files to or from an archive. To put all the files in a directory into one tar format file, simply type tar -cvf tarfile directory at a telnet command prompt and replace tarfile with the name you want to call your archived file, and replace directory with the name of the directory that contains the files you want to compress.



To extract the files from a tar format archive, simply type tar -xvf tarfile at a telnet command prompt and replace tarfile with the name of the archived file you are extracting.



For example, you could type tar -cvf pages.tar htdocs at a telnet command prompt to archive the files in the htdocs directory to a tar format file called pages.tar. To view the contents of the pages.tar tarfile without extracting them, type tar -tvf pages.tar. This will display all files that are included in the tar archive. You could also type tar -xvf pages.tar at a telnet command prompt to extract the files in the archive pages.tar into your current directory.



Example: % tar -cvf mysite.tar ~/www/htdocs/

zip [options] [zipfile] [files] The zip command compresses a file or list of files into a zip format archive file. Zip files are a common archive format used on PCs (using programs such as PKZip or WinZip), so the zip utiltity is ideal to compress large files or several files for transfer between your Virtual Private Server and your PC.



DOS Equivalent: pkzip



Example: % zip mysite.zip ~/www/htdocs/
unzip [options] [zipfile] unzip extracts the contents of a zip file made using the zip command or using WinZip or PKZip on your PC.



Example: % unzip mysite.zip ~/www/htdocs/

Additional Documentation

If you would like to know more about a particular command, you can consult the online manual
page (manpage) by connecting to your Virtual Private Server via Telnet
or SSH
and issuing the following command.

% man COMMAND

Share this
10
Average: 10 (2 votes)
Your rating: None

2 comments

9
Aug

A sophisticated and classy

A sophisticated and classy messenger tote from <a href="http://www.coachshop711.com/">cheap Coach handbags</a>, made from khaki signature jacquard fabric trimmed with gold leather and brass hardware. This stylish hobo bag by <a href="http://www.coachshop711.com/">Coach outlet</a> is a perfect combination between signature jacquard fabric and a trendy metallic leather handle make a bold. <a href="http://www.coachshop711.com/">Coach bags</a> gorgeous chocolate patent leather, contrast stitching and polished brass hardware make <a href="http://www.coachshop711.com/">Coach handbags outlet </a> an elegant, minimalist choice to go with any attire. t also features leather rounded handles, four protective brass feet on base of bag.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

1
Sep

When I was asked to give a

When I was asked to give a write-up, on the bailey ugg boots uk topic “Life is Beautiful” I smiled. I believed it was a simple topic with a very simple uggs bailey button boots proposition. With a firm belief in myself, I tried to pen a few cheap ugg boots argyle words. I found myself helpless as I had fiddled away precious ugg argyle knit time. Apparently an innocuous proposition made me ponder, which began in a listless uggs classic cardy way and later took a definite direction.As my thought process gained some ugg classic cardy tall ground, I could not fathom the depth of this topic nor scale the height of it. At one sundance ugg boots time I thought it could be dealt by filling the write up with ugg sundance boots anecdotes of my life and thus proving Life is Beautiful. The very next instance made me shudder, as a serious topic should be dealt tall uggs on sale philosophically. A chain developed with one approach giving way to the other.This approach classic tall uggs closely follows the philosophical ugg boots sale uk approach with a beauty of its own. To appreciate the beauty of life one can relish the uggs boots works of artists and writers of renaissance ugg boots online store uk period. Be it Da Vinci with the ethereal Mona Lisa, Rembrandt or Monet with Water Lillies brought out the essence of ugg boots from usa life. http://www.uggsbailey.co.uk/sitemap.html LIJ<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Post new comment

 
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Donate to Us


Activity Stream

Who's online

There are currently 0 users and 16 guests online.
Theme designed by Donny Carette - Powered by Drupal - copyright © 2010