User Management Tricks

From Wiki [en] OpenMandriva
Jump to: navigation, search
This wiki article may have one or more issues, and require cleanup or review in order to comply with the OpenMandriva Wiki Quality Standards.
Please help improve it or discuss these issues on the talk page. The following reason was given: Needs proofreading; Also split out find commands from article?


not also forget or ever was searched and not found again, but one knows how to have them around and experimenting now bite on the tongue, that has not been written? Here are various eye strings and lists several ways that can make life easier for the prompt and can also be very informative. If your posting in as the root user string's's Forum You could also subscribe right here so you have a faster access to it and does not always look for.

Useraccounts und Groups

Let show Useraccouts

cat /etc/passwd

perl -e '@lines=`cat /etc/passwd`; foreach $line (@lines){ $_=$line; if(/(.*):x/){printf $1 . "\n";}}'

awk -F: '{print $1}' < /etc/passwd

Group affiliations

cat /etc/group |grep username

Replace string's in files


Such actions are error prone, MUST work with a BACKUP!

sed -e 's/' datei.html

cp -f PFAD/WAHL PFAD/00alt_WAHL && sed -e 's\#\#\#g' PFAD/00alt_WAHL |tee PFAD/WAHL

tee splitting the stream in a file AND in the Console:

cp datei.htm datei.backup && SED xxx datei.backup |tee datei.htm

Combining at all with the "find"

must be replaced by the Dateieinamen variables, something like that (totally untested):

for f in 'find ./ -name "*.html"' ;

do $f ;

cp $f $f.backup && SED xxx $f.backup |tee $f ;


'm not as fit with find, therefore, no guarantee, it is more likely than suggestion for the test used.

I now propose even a stand-alone solution :)

sed -i.old -e 's/cd/xx/g' $(find ./ -name "*.txt*")

you replaced all files named *.html the string

-i.old stating that the file is edited directly and
Backup is created with the extension .old
The rest should be clear :)

find ./ -name "*.html" -exec sed -e 's/' {} \;

with the command

find ./ -name "*.html" -exec sed -i.old -e 's/' '{}' \;

'' through ''. Each file will be automatically backed up before the change. The old file is saved in the same directory and it will be given you specified with the "-i" suffix. (here "*.old")

Are you not satisfied with the changes, you need to rename again only the appropriate the *.old file.
Are you satisfied, you can delete files the "*.old".

The command must be run from the directory where the files and directories of your web pages are.

More Info:

man find

man sed

Better than you can explain it hardly :)

Followup to "find"

Proposes a patch-test fails, then the offending sections to patch the file with the extension. Rej provided stored. To these »Reject« files to find, you can use the program find:

find . -name '*.rej' -print

This lists all files with the extension ".rej" on which are located in the current directory and its subdirectories.

These pesky *.orig files...

patch sets from backup copies all modified files with the extension "orig" to.

This company already applied patches after some one a considerable space;

01.01.48 to 01.01.51 there were about half a MB.

Here, too, helps the find command to delete all these files at once:

find . -name '*.orig' -exec rm -f {} ';'

Alternatively, the GNU tool be used xargs:

find . -name '*.orig' | xargs rm

You can also use "find" but then so :

Search by file and run example "seach and move" ;)

find . -name '*.rpmnew' -exec cp -v {} /test ';'

to 'rall nichts'/'non checker':

The man pages of 'find' and 'sed' and read a bit of trial and error helps.

Then you realize very quickly that the console makes really fun :)