2.Understand and use essential tools - RHEL7
Access a shell prompt & issue commands with correct syntax.
STEP 1
Login to your Linux System
use Putty console or the terminal to access the shell prompt
Now, let’s check the command syntax.
STEP 2
To issue commands with the correct syntax always consult the man command for the command
For example, run the man command for ls
# man ls
STEP 3
Use input-output redirection (>, >>, |, 2>, etc.).
Output Redirection
the notation > file normally writes the command output to standard output / file
# echo cats > cats.txt
# ls > listing.txt
note with the above notation if the file is not empty then the command will rewrite your file contents.
the notation >> file normally writes the command output to standard output / file
echo cats >> cats.txt
ls >> listing.txt
# echo cats >> cats.txt
# ls >> listing.txt
The difference between this operator is that if the file is empty it will write the data to the last line and it will not rewrite the file.
The Operator |
Takes output from one program, or process, and sends it to another program or process.
Example:
listing all the contents of a directory then taking the output and pass it to the cut command to process the delimiter t and grab the first field string.
ls -al | cut -d “t” -f1
The operator 2>
Represents is standard error output (STDERR).
sh script.sh 2> /dev/null
Input Redirection
the less-than character < is used to redirect the input of a command.
Use grep and regular expressions to analyze text.
cat << EOF This is a text for input redirection EOF
Access remote systems using ssh.
Log in and switch users in multiuser targets.
Archive, compress, unpack, and uncompress files using tar, star, gzip, and bzip2.
Create and edit text files.
Create, delete, copy, and move files and directories.
- Create a file
# touch filename
- Create a directory
# mkdir directoryname
Create hard and soft links.
List, set, and change standard ugo/rwx permissions.
Locate, read, and use system documentation including man, info, and files in /usr/share/doc.