Tag Archives: linux terminal commands

Bash: File content tricks

Using bash to get some data from the files can be very useful. Here are some essential tricks to get you started.

  1. See if the file has a word called “hello”:

cat file.txt |grep hello

  1. Compare two files using cmp / cmp is usually part of the diffutils package.

This part is best done with simple script. However, scripting is not mandatory when using cmp.

#!/bin/bash

# Creating two new files with: echo "Helllo" > file.txt && echo "Hello" > file2.txt

file1="file.txt"
file2="file2.txt"

if cmp "$file1" "$file2"; then
echo "Files are the same."
else
echo "Files are not the same."
fi

Continue reading

Essential terminal tricks you should know

Here are few of my favorite terminal tricks that might be useful to other users as well.

1. Your live media automatically logs you in but you need to set a custom DPI value, Press Control+ALT+F3 (usually also F4,F5,F6 will work) and open another instance of a virtual terminal. The actual number of terminals depends upon system settings. From another virtual terminal instance you can easily start a new session. This time around the automatic login should not happen since the live media already has reached this goal with the initial instance. This trick might not work with heavy window managers but with lightweight ones it should work just fine. Continue reading

Essential terminal commands

Here I will list some general commands which will help you to work inside a terminal and give you the abilities to control your Linux box via terminal. These commads might also come useful if you are using your Linux desktop without a display manager (see more from this post:https://www.techtimejourney.net/?p=622)

Remember this: what happens in terminal usually stays in terminal. If you accidentally delete something then it is gone for good. So caution is adviced. Continue reading