Linux is a Operating system that is increasing its users by its benefits.
1.How to Empty a file using ‘>’ operator ?
Suppose you want to empty a file from command line.
Here is how easily you can do it :
This will delete all the contents of the file ‘logfile’ and empty it.
2.How to search man pages for a particular string?
You might have used Linux man pages to understand more about a command, function etc. But, what if you want to know which man pages discuss about a particular topic. For example, what if I want to know that which man pages discuss about ‘login’?
Well, there exists an option -k through which you can do this. Here is an example :
but to become expert it is necessary to learn all the basic and needy Tricks/Commands for linux. So, I will write some Tricks
1.How to Empty a file using ‘>’ operator ?
Suppose you want to empty a file from command line.
Here is how easily you can do it :
$ > [complete file path]
For example :
For example :
$ > ./logfile
This will delete all the contents of the file ‘logfile’ and empty it.
2.How to search man pages for a particular string?
You might have used Linux man pages to understand more about a command, function etc. But, what if you want to know which man pages discuss about a particular topic. For example, what if I want to know that which man pages discuss about ‘login’?
Well, there exists an option -k through which you can do this. Here is an example :
$ man -k login
access.conf (5) - the login access control table file
add-shell (8) - add shells to the list of valid login shells
chsh (1) - change login shell
faillog (5) - login failure logging file
faillog (8) - display faillog records or set login failure limits
getlogin (3) - get username
getlogin_r (3) - get username
gnome-session-properties (1) - Configure applications to start on login
hotot (7) - lightweight & opensource microbloging client
issue (5) - prelogin message and identification file
lastlog (8) - reports the most recent login of all users or of a given user
login (1) - begin session on the system
login (3) - write utmp and wtmp entries
login.defs (5) - shadow password suite configuration
login_tty (3) - tty utility functions
logname (1) - print user's login name
So we see that all the man pages that discuss about ‘login’ were displayed in the output.
3.How to simulate on-screen typing just like you see in movies?
Well, to simulate typing just like you see in movies, use ‘pv’ command.
Try this out : echo "You can simulate on-screen typing just like in the movies" | pv -qL 10
Check the output for yourself.
issue (5) - prelogin message and identification file
lastlog (8) - reports the most recent login of all users or of a given user
login (1) - begin session on the system
login (3) - write utmp and wtmp entries
login.defs (5) - shadow password suite configuration
login_tty (3) - tty utility functions
logname (1) - print user's login name
So we see that all the man pages that discuss about ‘login’ were displayed in the output.
3.How to simulate on-screen typing just like you see in movies?
Well, to simulate typing just like you see in movies, use ‘pv’ command.
Try this out : echo "You can simulate on-screen typing just like in the movies" | pv -qL 10
Check the output for yourself.
Tag :
Miscellaneous,
Tips & Tricks