Difference between revisions of "Trillex linux 1"

From Teknologisk videncenter
Jump to: navigation, search
Line 7: Line 7:
 
Shuts down the computer. When is usually described at the end of this command.
 
Shuts down the computer. When is usually described at the end of this command.
 
  Example:
 
  Example:
  shutdown now     # Shuts down the computer NOW.
+
  shutdown now             # Shuts down the computer NOW.
  
 
=== find Command ===
 
=== find Command ===
Line 13: Line 13:
  
 
  Example:
 
  Example:
  find /           # List all files
+
  find /                   # List all files
  find /etc         # List all files under the /etc directory
+
  find /etc                 # List all files under the /etc directory
find / | wc -l    # List all files, but don't show them on the screen
 
                  # The "|" is a pipe which directs output to the
 
                  # ''wc'' command as input. ''wc'' is ''wordcount''. The toggle
 
                  # "-l" means count lines.
 
  
 
=== ls Command ===
 
=== ls Command ===
Line 26: Line 22:
 
The '''cat''' command shows the content of a file
 
The '''cat''' command shows the content of a file
 
  Example:
 
  Example:
  cat /etc/passwd   # Shows the content of the file '''passwd'''
+
  cat /etc/passwd           # Shows the content of the file '''passwd'''
  
 
=== whereis Command ===
 
=== whereis Command ===
 
Shows the position of certain files and programs.
 
Shows the position of certain files and programs.
  
  whereis bash     # Outputs where files named '''bash''' are
+
  whereis bash             # Outputs where files named '''bash''' are
  
 
=== vi Command ===
 
=== vi Command ===
Line 38: Line 34:
  
 
  Example:
 
  Example:
  vi interfaces     # Views the '''interfaces''' file
+
  vi interfaces             # Views the '''interfaces''' file
  
 
=== file Command ===  
 
=== file Command ===  
 
Output what kind of file type it is.  
 
Output what kind of file type it is.  
 
+
 
 
  Example:
 
  Example:
  file /etc/passwd # This command will output: ''/etc/passwd: ASCII text'' meaning it's using ASCII
+
  file /etc/passwd         # This command will output: ''/etc/passwd: ASCII text'' meaning it's using ASCII
  
 
=== wc Command ===
 
=== wc Command ===
Line 50: Line 46:
  
 
  Example:
 
  Example:
  wc /var/log/dmesg # Counts lines, words and bytes in that file. Can have optional options like -l, which will only output lines.  
+
  wc /var/log/dmesg         # Counts lines, words and bytes in that file. Can have optional options like -l, which will only output lines.
 +
 
 +
== The Pipe Sign ==
 +
The Pipe Sign '''|''' (Alt + 0166) is a sign that takes the output from one command and puts it into another.
 +
 
 +
Example:
 +
cat /etc/passwd | wc -l  # This will take the output of '''cat''' and process it through '''wc -l'''. It will then output the amount of lines in the file '''passwd'''.
  
 
== Important Files ==  
 
== Important Files ==  

Revision as of 14:00, 10 February 2009

Commands and Important Tools/Files

Commands

logout Command

Does exactly what it says on the tin. Logs out the current user on that terminal.

shutdown Command

Shuts down the computer. When is usually described at the end of this command.

Example:
shutdown now              # Shuts down the computer NOW.

find Command

The command find find files on the filesystem.

Example:
find /                    # List all files
find /etc                 # List all files under the /etc directory

ls Command

List files just like dir does it in a Windows command prompt

cat Command

The cat command shows the content of a file

Example:
cat /etc/passwd           # Shows the content of the file passwd

whereis Command

Shows the position of certain files and programs.

whereis bash              # Outputs where files named bash are

vi Command

To view files, such as certain configuration files, you'd need to make use of the vi command. It can, however, differ on what kind of viewer is in your distribution. vi is very common, though.

Example:
vi interfaces             # Views the interfaces file

file Command

Output what kind of file type it is.

Example:
file /etc/passwd          # This command will output: /etc/passwd: ASCII text meaning it's using ASCII

wc Command

wc stands for wordcount. What it does is counts specific things in a file such as lines, characters etc.

Example:
wc /var/log/dmesg         # Counts lines, words and bytes in that file. Can have optional options like -l, which will only output lines. 

The Pipe Sign

The Pipe Sign | (Alt + 0166) is a sign that takes the output from one command and puts it into another.

Example: 
cat /etc/passwd | wc -l   # This will take the output of cat and process it through wc -l. It will then output the amount of lines in the file passwd.

Important Files

The /etc Directory

passwd File

The passwd file contains all user names as well as their home directory and the shell they use.

IP Configuration Files

The configuration file(s) for common network setup is normally located in /etc/sysconfig/network-scripts/. It is named according to the network interface number on the computer.

In Debian-based distributions - such as Ubuntu - it is located in /etc/network/ The file in Ubuntu is called interfaces.

In normal circumstances it'd be called ifcfg.eth0 and upwards.