Article 3: Linux commands : to make day to day life walkover
Click here, to read various articles from our series Linux commands: to make day to day life walkover
Some special symbols like * and ? are known as wildcards in Linux.
* wildcard is used to match against none or more character(s) in a file (or directory) name.
Suppose we do have some files those name ends with .txt
These files can be accessed by using * instead of file1, file2 and file3.
- $cp *.txt path/to/destination
- $rm *.txt %% will delete all these files
The character ? will match exactly one character. So ?ut will match files like put and cut but not shut.
$cp ?ut path/to/destination
It will copy only two file by namely put and cut because shut has two different characters ( s & h).
This command is used to compare data of two ( can not compare more then two files ) files and shows difference between files in terminal window.
Suppose you have two files by namely file1 and fil2. To see differences type
$diff file1 file2
Lines beginning with a < belongs to file1. while lines beginning with > belongs to file2
- vimdiff is also used to compare files. But using vimdiff you can compare more then two files at a time.
- Using vimdiff you can edit or update your files.
$vimdiff file1 file2 file3
To edit these files (file1, file2 and file3) press “i”, you will see your cursor in file1 as follows
To edit second pan of this terminal window
- Press ESC
- Ctrl + w + w
- Press “i”
Now check you second pan of terminal window
Help regarding different commands
man command can be used to find in depth detail of commands
Will give all information about cp command, as follows:
whatis command gives a short (one or two lines) description of commands
It will show a one line description about cp command, as follows.
When you are not fully confident of the exact name of commands. You need to type a keyword related to command for which you are looking.
Let’s suppose you are looking for rmdir command, but not confident of the exact name of command
It will show some commands on terminal as follows.
To know your username just type whoami, as follows
Output will be username of your system (ramesh is user name of mine)