What I learned about linux:

You can use the pwd command to print the working directory.. To list the contents of a directory, you use the ls command (short for list). When you run the ls command without any arguments, it lists the contents of the present working directory by default. You can change to a different directory using the cd command (short for change directory). ls or the ls -l command will print the contents of the home director only when the current working directory is the home directory itself. • If you don’t provide any argument to the cd command, it defaults to the user’s home directory. The ls command defaults to the present working directory. • There is a symbol to denote a user’s home directory. The tilde (~) sign. • cd ~ will take you to your home directory. • ls ~ will list the contents of your home directory.

Datetime shown in the "ls -l" output is the last modification time not the creation time of the file echo command is used to print out the value provided to it. By default, it prints the value to the terminal which is the "standard output". Try running echo 'Congratulations on running a bash script' echo "echo 'Congratulations on running a bash script'" prints echo 'Congratulations on running a bash script' to the terminal. We can redirect the output instead to a file using the redirection operator >. You can verify this indeed was happening earlier by cating the content of the run.sh file from earlier to the terminal.

Feeding Output of a command to the Input of another:

The /proc/meminfo file has info related to the RAM installed in our system. Try using cat to print its content. The first three lines are the attributes MemTotal, MemFree & MemAvailable.

grep command is used to filter/search for text using strings or patterns. It’s usage is grep . For us, it’d be grep MemFree /proc/meminfo. You’ll see only the line containing MemFree from /proc/meminfo filtered out. Let’s write it to a file using the redirection operator (>) we learnt in the previous section.

Piping is a type of redirection in Linux used to send output of one command to input of another command. We had earlier written the output of grep to a file & then used it as input to awk. Instead of this, we can use the Linux pipe operator (|) to redirect output of grep directly to input of awk.

Built With

Share this project:

Updates