Difference between revisions of "Basics"

From Amahi Wiki
Jump to: navigation, search
(New page: A small Linux cheat sheet, introducing the very basic and very essential commands for surviving at the Linux CLI. ===Moving around in the file system=== '''Command Action''' pwd ...)
 
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
A small Linux cheat sheet, introducing the very basic and very essential commands for surviving at the Linux CLI.
+
See [[Linux-hda commands|Linux HDA Commands]] for Amahi HDA-specific commands.
 +
 
 +
This is a small Linux cheat sheet, introducing the very basic and very essential commands for surviving at the Linux Command Line Interface (CLI).
  
 
===Moving around in the file system===
 
===Moving around in the file system===
 +
<table border="1">
 +
<tr>
 +
<th>Command</th>
 +
<th>Action</th>
 +
</tr>
 +
<tr>
 +
<td>pwd</td>
 +
<td>"Print working directory" - show what dir you're in.</td>
 +
</tr>
 +
<tr>
 +
<td>ls</td>
 +
<td>List the contents of a dir.</td>
 +
</tr>
 +
<tr>
 +
<td>ls -l</td>
 +
<td>List the contents of a dir and show additional info of the files.</td>
 +
</tr>
 +
<tr>
 +
<td>ls -a</td>
 +
<td>List all files, including hidden files.</td>
 +
</tr>
 +
<tr>
 +
<td>cd</td>
 +
<td>Change directory.</td>
 +
</tr>
 +
<tr>
 +
<td>cd ..</td>
 +
<td>Go to the parent directory.</td>
 +
</tr>
 +
</table>
  
'''Command Action'''
 
pwd         "Print working directory" - show what dir you're in.
 
ls         List the contents of a dir.
 
ls -l         List the contents of a dir and show additional info of the files.
 
ls -a         List all files, including hidden files.
 
cd         Change directory.
 
cd ..         Go to the parent directory.
 
  
 
===Examining files===
 
===Examining files===
 +
<table border="1">
 +
<tr>
 +
<th>Command</th>
 +
<th>Action</th>
 +
</tr>
 +
<tr>
 +
<td>file</td>
 +
<td>Determine the type of a file.</td>
 +
</tr>
 +
<tr>
 +
<td>cat</td>
 +
<td>Concatenate a file.</td>
 +
</tr>
 +
<tr>
 +
<td>less</td>
 +
<td>View text files and paginate them if needed.</td>
 +
</tr>
 +
<tr>
 +
<td>[[Linux-find|find]]</td>
 +
<td>find files or directories.</td>
 +
</tr>
 +
</table>
  
'''Command Action'''
+
===Manipulating files and directories===
file         Determine the type of a file.
+
<table border="1">
cat         Concatenate a file.
+
<tr>
less         View text files and paginate them if needed.
+
<th>Command</th>
 +
<th>Action</th>
 +
</tr>
 +
<tr>
 +
<td>cp</td>
 +
<td>Copy a file.</td>
 +
</tr>
 +
<tr>
 +
<td>cp -i</td>
 +
<td>Copy a file and ask before overwriting.</td>
 +
</tr>
 +
<tr>
 +
<td>cp -r</td>
 +
<td>Copy a directory with its contents.</td>
 +
</tr>
 +
<tr>
 +
<td>mv</td>
 +
<td>Move or rename a file.</td>
 +
</tr>
 +
<tr>
 +
<td>mv -i</td>
 +
<td>Move or rename a file and ask before overwriting.</td>
 +
</tr>
 +
<tr>
 +
<td>rm</td>
 +
<td>Remove a file.</td>
 +
</tr>
 +
<tr>
 +
<td>rm -r</td>
 +
<td>Remove a directory with its contents.</td>
 +
</tr>
 +
<tr>
 +
<td>rm -i</td>
 +
<td>Ask before removing a file. Good to use with the -r option.</td>
 +
</tr>
 +
<tr>
 +
<td>mkdir</td>
 +
<td>Make a directory.</td>
 +
</tr>
 +
<tr>
 +
<td>rmdir</td>
 +
<td>Remove an empty directory.</td>
 +
</tr>
 +
<tr>
 +
<td>nano</td>
 +
<td>Interactively edit a text file (sort of the command line equivalent to notepad.exe or TextEdit)</td>
 +
</tr>
 +
</table>
  
  
===Manipulating files and directories===
+
===Files/Directory Permissions===
 +
<table border="1">
 +
<tr>
 +
<th>Command</th>
 +
<th>Action</th>
 +
</tr>
 +
<tr>
 +
<td>chown</td>
 +
<td>Change ownership</td>
 +
</tr>
 +
<tr>
 +
<td>chgrp</td>
 +
<td>Change group</td>
 +
</tr>
 +
<tr>
 +
<td>chmod</td>
 +
<td>Change permissions</td>
 +
</tr>
 +
</table>
 +
 
 +
 
 +
'''NOTE:'''  [http://www.webune.com/an-example-code-script-of-javascript-linux-permission-chart-table-chmod-s81.html Linux Permission Chart Table] calculates based on user input.
  
'''Command Action'''
+
Another good link on the basics of [http://www.ahinc.com/linux101/permission.htm linux permissions].
cp         Copy a file.
 
cp -i         Copy a file and ask before overwriting.
 
cp -r         Copy a directory with its contents.
 
mv         Move or rename a file.
 
mv -i         Move or rename a file and ask before overwriting.
 
rm         Remove a file.
 
rm -r         Remove a directory with its contents.
 
rm -i         Ask before removing a file. Good to use with the -r option.
 
mkdir         Make a directory.
 
rmdir         Remove an empty directory.
 
  
===Files and directory Permissions===
+
=== CRON Tester ===
 +
[http://cron.schlitt.info/ CRON Tester] and [http://www.cronchecker.net cron checker] will show you what your CRON definition equates too in time and frequency. 
  
'''Command Action'''
+
For example, <code>0 2 * * *</code> equates to ''2AM daily''.
chown          Change ownership
 
chgrp          Change group
 
chmod          Change permissions
 

Latest revision as of 01:53, 7 February 2015

See Linux HDA Commands for Amahi HDA-specific commands.

This is a small Linux cheat sheet, introducing the very basic and very essential commands for surviving at the Linux Command Line Interface (CLI).

Moving around in the file system

Command Action
pwd "Print working directory" - show what dir you're in.
ls List the contents of a dir.
ls -l List the contents of a dir and show additional info of the files.
ls -a List all files, including hidden files.
cd Change directory.
cd .. Go to the parent directory.


Examining files

Command Action
file Determine the type of a file.
cat Concatenate a file.
less View text files and paginate them if needed.
find find files or directories.

Manipulating files and directories

Command Action
cp Copy a file.
cp -i Copy a file and ask before overwriting.
cp -r Copy a directory with its contents.
mv Move or rename a file.
mv -i Move or rename a file and ask before overwriting.
rm Remove a file.
rm -r Remove a directory with its contents.
rm -i Ask before removing a file. Good to use with the -r option.
mkdir Make a directory.
rmdir Remove an empty directory.
nano Interactively edit a text file (sort of the command line equivalent to notepad.exe or TextEdit)


Files/Directory Permissions

Command Action
chown Change ownership
chgrp Change group
chmod Change permissions


NOTE: Linux Permission Chart Table calculates based on user input.

Another good link on the basics of linux permissions.

CRON Tester

CRON Tester and cron checker will show you what your CRON definition equates too in time and frequency.

For example, 0 2 * * * equates to 2AM daily.