Difference between revisions of "Introduction to Linux"

From Void-Byte
Jump to navigation Jump to search
Line 15: Line 15:
 
|-
 
|-
 
|'''cat'''
 
|'''cat'''
|Used to concatenate files, and print to stdout.
+
|Concatenate files, and print to stdout.
 
|cat [-options] <path/file>
 
|cat [-options] <path/file>
 
|cat readme.txt
 
|cat readme.txt
 
|-
 
|-
 
|'''cp'''
 
|'''cp'''
|Used to copy files and directories.
+
|Copy files or directories.
 
|cp [-options] <source> <destination>
 
|cp [-options] <source> <destination>
 
|cp -R olddirectory newdirectory
 
|cp -R olddirectory newdirectory
 
|-
 
|-
 
|'''echo'''
 
|'''echo'''
|Used to print text to stdout.
+
|Print text to stdout.
 
|echo [-options] <string>
 
|echo [-options] <string>
 
|echo -e This my first line \n This is my second line
 
|echo -e This my first line \n This is my second line
 
|-
 
|-
 
|'''ls'''
 
|'''ls'''
|Used to list directory contents.
+
|List directory contents.
 
|ls [-options] <path/file>
 
|ls [-options] <path/file>
 
|ls -alh /var/log
 
|ls -alh /var/log
 
|-
 
|-
 
|'''mkdir'''
 
|'''mkdir'''
|
+
|Make a directory.
|
+
|mkdir [-options] <path/directory>
|
+
|mkdir -p /my/directory/path
 
|-
 
|-
 
|'''mv'''
 
|'''mv'''
|
+
|Move or rename a file.
|
+
|mv [-options] <source> <destination>
|
+
|mv /from/here/file1.txt /to/here/file1.txt
 
|-
 
|-
 
|'''pwd'''
 
|'''pwd'''
|
+
|Print the current working directory.
|
+
|pwd [-options]
|
+
|pwd -P
 
|-
 
|-
 
|'''touch'''
 
|'''touch'''
|
+
|Change file timestamp or create blank file.
|
+
|touch [-options] <path/file>
|
+
|touch -c update.txt
 
|}
 
|}
 
<br />
 
<br />

Revision as of 16:39, 8 June 2020

Basic Commands

These are the most basic commands that you should know as a Linux System Administrator.

Command Syntax

Commands that utilize the Bash shell follow this common syntax.

command [-options] [arguments]

Commands

Name Description Syntax Example
cat Concatenate files, and print to stdout. cat [-options] <path/file> cat readme.txt
cp Copy files or directories. cp [-options] <source> <destination> cp -R olddirectory newdirectory
echo Print text to stdout. echo [-options] <string> echo -e This my first line \n This is my second line
ls List directory contents. ls [-options] <path/file> ls -alh /var/log
mkdir Make a directory. mkdir [-options] <path/directory> mkdir -p /my/directory/path
mv Move or rename a file. mv [-options] <source> <destination> mv /from/here/file1.txt /to/here/file1.txt
pwd Print the current working directory. pwd [-options] pwd -P
touch Change file timestamp or create blank file. touch [-options] <path/file> touch -c update.txt