Jump to content
Sign in to follow this  
Guest anon

"Lost" Tips (451-500)

Recommended Posts

Guest anon

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Indian Language support to Linux LOST #451

 

For Indian language support on Linux point your browser to

http://www.indlinux.org/

 

####[manish_shilpajp (at) yahoo.co.jp]########################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : To play a .dat extension file through xine LOST #452

 

To play a .dat extension file through xine; use:

$ cat <filename.dat> | xine stdin://mpeg1

 

####[abhiramkushwah (at) rediffmail.com]######################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : tcpserver: alternative to [x]inetd [#1] LOST #453

 

tcpserver (http://cr.yp.to/ucspi-tcp.html) by Dan Bernstein is

a secure stable and flexible alternative to [x]inetd. You will

need daemontools (http://cr.yp.to/daemontools.html) as well to

supervise and log services started from tcpserver.

 

####[mallet (at) efn.org]#####################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : tcpserver: alternative to [x]inetd [#2] LOST #454

 

tcpserver sample "run" script for vsftpd -

#!/bin/sh

exec tcpserver -c30 -HRXv -llocalhost -x

/service/vsftpd/vsftpd.cdb 0 ftp /usr/local/libexec/vsftpd

/usr/local/etc/vsftpd.conf 2>&1

 

####[mallet (at) efn.org]#####################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : tcpserver: alternative to [x]inetd [#3] LOST #455

 

Stopping tcpserver (vsftpd daemon). Whereas starting is auto-

matic (man svscan for further details), To stop vsftpd:

# svc -dk /service/vsftpd/ AND

# svc -ua /service/vsftpd - start vsftpd and bring it up.

 

####[mallet (at) efn.org]#####################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Brave GNU World LOST #456

 

Georg CF Greve monthly column 'Brave GNU World' introduces new

GNU projects, that range from games to helping install on old

hardware and more... Check out http://brave-gnu-world.org

 

####[fred (at) bytesforall.org]###############################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : How to view all users/ daemons running LOST #457

 

Type '~' at the shell prompt and press [tab] twice

viz. [user@machine]$ ~ [press TAB][press TAB]

 

####[sachinr (at) unitek.co.in]###############################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : How to view all accounts on your system LOST #458

 

To view ALL users on your system inclusive of root and system

users with UID less than 100, do:

 

$ cat /etc/passwd | cut -d ":" -f1 | less OR

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

 

####[rarvind (at) users.sourceforge.net]######################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Firing off mozilla mail components LOST #459

 

You can fire of mail components of mozilla without having to

go through the browser link:

mozilla -mail .... mozilla mail inteface

mozilla -compose .... mozilla mail composer directly

 

####[bish (at) nde.vsnl.net.in]###############################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Tracing installation details of make install LOST #460

 

Kind of wondering where in your system things have gone after

a 'make install' command ?

# make install 2>&1 | tee /tmp/install.out

This file install.out has all details of files installed, in

case a manual removal is needed at a later date

 

####[mallet (at) efn.org]#####################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#1] LOST #461

 

# Under awk, 'field' means 'column'

# Print first two fields in opposite order:

awk '{ print $2, $1 }' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#2] LOST #462

 

# Print only lines longer than 50 characters:

awk 'length > 50' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#3] LOST #463

 

# Print length of string in 2nd column of a text file

awk '{print length($2)}' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#4] LOST #464

 

For a text file having numbers in columns, to get sum and the

average of all numbers in column No 1 of the numeric file do:

 

cat numeric_file | awk '{ s += $1 }

END { print "sum =", s, " avg =", s/NR }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#5] LOST #465

 

# To Print fields (columns) in reverse order:

awk '{ for (i = NF; i > 0; --i) print $i }' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#6] LOST #466

 

To print the last line of a text file (viz same as 'tail -1'):

 

cat textfile | awk '{line = $0}

END {print line}'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#7] LOST #467

 

# Number count of lines containing the word "Pat" in a file:

$ cat textfile | awk '/Pat/ {nlines = nlines + 1}

END {print nlines}'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#8] LOST #468

 

# Print all lines between unique start/stop pairs:

awk '/start/, /stop/' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#9] LOST #469

 

# Print all lines whose first field (column) is different from

# the previous one:

$ awk '$1 != prev { print; prev = $1 }' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#10] LOST #470

 

# Print column 3, if column 1 > column 2:

$ awk '$1 > $2 {print $3}' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#11] LOST #471

 

# Print line if column 3 > column 2:

$ awk '$3 > $2' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#12] LOST #472

 

# Count number of lines where col 3 > col 1

$ awk '$3 > $1 {print i + "1"; i++}' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#13] LOST #473

 

# Print sequence number and then column 1 of file:

$ awk '{print NR, $1}' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#14] LOST #474

 

# Print every line after erasing the 2nd field

$ awk '{$2 = ""; print}' textfile

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#15] LOST #475

 

# Print "Hello " 28 times

$ yes | head -28 | awk '{ print "Hello " }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#16] LOST #476

 

# Replace every field by its absolute value

cat textfile | awk '

{for (i = 1; i <= NF; i=i+1) if ($i < 0) $i = -$i print}'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#17] LOST #477

 

cat numeric_file | awk ' # Find maximum and

NR == 1 {m=$1 ; p=$1} # minimum values

$1 >= m {m = $1} # present in col 1

$1 <= p {p = $1} # of numeric_file

END { print "Max = " m, " Min = " p }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#18] LOST #478

 

You can even grep with awk. The command: "awk '/foo/' files"

is essentially the same as "egrep foo files" ...

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#19] LOST #479

 

This program prints seven random numbers from zero to 100,

inclusive of both.

 

awk 'BEGIN { for (i = 1; i <= 7; i++)

print int(101 * rand()) }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#20] LOST #480

 

This snippet prints the total number of bytes used by files.

 

$ ls -lg files | awk '{ x += $5 } ;

END { print "total bytes: " x }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#21] LOST #481

 

# This awk program counts lines in a file.

$ awk 'END { print NR }' my_data_file

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#22] LOST #482

 

# This awk program prints the even numbered lines in the

# my_data_file file.

$ awk 'NR % 2 == 0' my_data_file

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#23] LOST #483

 

# This awk program prints the odd numbered lines in the

# my_data_file file.

$ awk 'NR % 2 == 1' my_data_file

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#24] LOST #484

 

# Prints the total number of kilobytes used by files.

ls -lg files | awk '{ x += $5 }

END { print "total K-bytes: " (x + 1023)/1024 }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#25] LOST #485

 

# To delete blank lines from a text file

$ awk 'NF > 0' my_text_file

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#26] LOST #486

 

# Prints the length of the longest line in `my_data_file'.

# Input processed through "expand" to change tabs to spaces.

expand my_data_file | awk '{ if (x < length()) x = length()}

END { print "maximum line length is " x }'

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : awk tips [#27] LOST #487

 

# This program prints the length of the longest input line.

awk '{ if (length($0) > max) max = length($0) }

END { print max }' my_data_file

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : paste LOST #488

 

To join / merge corresponding lines on two different files

separated by tab use paste. (man paste for details)

 

####[balaji (at) irtt.org]####################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#1][awk] LOST #489

 

What does some strange unix command names stand for ?

awk = "Aho Weinberger and Kernighan"

This pattern scanning and text processing language was named

after its authors: Al Aho, Peter Weinberger, Brian Kernighan.

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#2][grep] LOST #490

 

What does some strange unix command names stand for ?

grep = "Global Regular Expression Print"

grep comes from the ed command to print all lines matching a

certain pattern 'g/re/p' where "re" is a "regular expression".

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#3][fgrep] LOST #491

 

fgrep = "Fixed GREP".

fgrep searches for fixed strings only. The "f" does not stand

for "fast"; in fact, "fgrep foobar *.c" is usually slower than

"egrep". Fgrep is useful when searching a file for a larger

number of strings than egrep can handle.

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#4][egrep] LOST #492

 

egrep = "Extended GREP"

egrep uses fancier regular expressions than grep.Many people

use egrep all the time, since it has some more sophisticated

internal algorithms than grep or fgrep, and is usually the

fastest of the three programs.

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#5][cat] LOST #493

 

cat = "CATenate"

catenate is an obscure word meaning "to connect in a series",

which is what the "cat" command does to one or more files.Not

to be confused with C/A/T, the Computer Aided Typesetter.

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#6][*roff] LOST #494

 

nroff = "New ROFF" : troff = "Typesetter new ROFF"

These are descendants of "roff", which was a re-implementation

of the Multics "runoff" program (a program that you would use

to "run off" a good copy of a document).

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#7][tee] LOST #495

 

tee = T

To take a lateral output. Taken from plumbing terminology for

a T-shaped pipe splitter.

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#8][biff] LOST #496

 

biff = "BIFF"

This command, which turns on asynchronous mail notification,

was actually named after a dog at Berkeley. As confirmed by

Eric Cooper (Carnegie Mellon University) "Biff" was popular

among the residents of Evans Hall, and was known for barking

at the mailman ...

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Genesis of unix command names [#9][rc] LOST #497

 

rc (as in ".bashrc" or ".cshrc" or ...) = "RunCom"

"rc" derives from "runcom", from the MIT CTSS system,ca. 1965.

There was a facility that would execute a bunch of commands

stored in a file; it was called "runcom" for "run commands",

and the file began to be called "a runcom"

 

####[banduji (at) symonds.net]################################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Removing the StarOffice/OpenOffice banner LOST #498

 

Step 1: Find out location of "sofficerc" [# locate sofficerc]

Step 2: Edit file /path/to/sofficerc

[bootstrap]

Logo=1 # Change this Logo=1 to Logo=0

 

####[agencies_ad1 (at) sancharnet.in]#########################

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Slackware package update tool (swaret) LOST #499

 

Looking for a apt-get equivalent for Slackware ? Try "swaret"

http://freshmeat.net/projects/swaret/

This is a bash script. It uses wget and rsync for fetching the

packages from the Slackware mirror chosen.

 

####[shridhar_daithankar (at) nospam.persistent.co.in]########

:

%

:

####[ GNU/Linux One Stanza Tip (LOST) ]#######################

 

Sub : Sorting numbers on numeric values LOST #500

 

[foo.txt]: | For doing a numeric sort on a text file with

Geeta 0.0002 | numeric data in second column; try:

Rohit -156.89 | $ sort -k2,2g foo.txt

Amit +4.5E-02 | [Note: sort -n does a string numeric sort]

 

####[hsrai (at) edumail.nic.in]###############################

:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...