19
0
This article lists some of the more useful ways of utilizing the find command.
These commands will work on most Linux distributions, and have been tested on recent versions of Fedora.
To find a file by its name, starting in the current directory and recursing through its children, use:
find . -name '<string>'
Search Inside Files
To search inside files, descending into subdirectories and listing ONLY the file names:
find . -print0 | xargs -0 grep '<search_phrase>' -sl
The above command will print out the names of the files that contain the <search_phrase>, which could be a regex.
Note that the above command works even with “funny” filenames that contain spaces or newlines. The “print0” and -0 option to xargs do the trick – you can see the xargs man page for an explanation of why this works!
Also, xargs is a
Read More...
23
0
Modes
Vi has two modes: insertion mode, and command mode.
The editor begins in command mode, where cursor movement
and text deletion and pasting occur. Insertion mode
begins upon entering an insertion or change command.
[ESC] returns the editor to command mode (where you can
quit, for example by typing :q!). Most commands execute
as soon as you type them except for “colon” commands
which execute when you press the return key.
Quitting
exit, saving changes :x
quit (unless changes) :q
quit (force, even if unsaved) :q!
Inserting text
insert before cursor, before line i , I
append after cursor, after line a , A
open new line after, line before o , O
replace one char, many chars r , R
(more…)
Read More...
17
5
Here are 5 linux commands that appear to be pretty useless. They might have been useful at sometime back in the day, but with the way linux has evolved today, they don’t appear to be of much use any longer.
clear
The clear command simply clears the terminal screen. I don’t find it useful since hitting CTRL-L is the quickest way of clearing the terminal screen.
rev
The rev command as described on its man page is a utility that copies the specified files to the standard output, reversing the order of characters in every line. If no files are specified, the standard input is read.As an example, I typed the sentence “Linux is fun” Here is what the rev command will give me as a result:
$ rev
Linux is fun
nuf si xuniL
(more…)
Read More...
