Unix/Linux Go Back    


BSD BSD, sometimes called Berkeley Unix, is a Unix operating system developed by the Computer Systems Research Group of the UC Berkeley.

Mcookie, pkg -l to generate random sequence

BSD


Tags
bsd, generate random sequence alphanumerical, mcookie, solved

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-07-2015
1in10's Unix or Linux Image
1in10 1in10 is offline
Registered User
 
Join Date: Jun 2014
Last Activity: 30 March 2017, 12:04 AM EDT
Location: Brazil
Posts: 121
Thanks: 38
Thanked 4 Times in 4 Posts
(solved) Mcookie, pkg -l to generate random sequence

I am setting this thread to this bsd forum, though it may fit into bash. But as using bsd and the terminal, I would like to generate a random sequence of alphanumerical digits, such as I use to do so on linux by typing just

Code:
mcookie

this one gives me a pretty random password, but it does not on bsd 10.1.
Does someone have any idea without creating that via


Code:
tr -dc a-z1-9 < /dev/urandom

or other similar constructions even more complicated?
by typing

Code:
pkg -l

the list of commands is pretty short. Hitting twice the tab-space as root does not help either as is lists all in linux.
Any hints? Thanks in advance.

So I have been trying the following command without success, because md5sum and sha256sum or higher are not present on my bsd, for either root or user.


Code:
date  | m5sum

as well with the other ones.
While typing the following longer command (I read the manual about random and urandom)


Code:
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n1

all I get as an answer is


Code:
tr: Illegal byte sequence

Someone may knows what is wrong with this lack of commands? And is there a shorter way to generate such a random password? Thanks in advance.


Solved, or lets say, for this particular case, solved, because any attempt with tr went to illegal byte sequence, so the following line did it.



Code:
TMPFILE=`mktemp tmp.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` &&  echo $TMPFILE


Last edited by 1in10; 10-08-2015 at 10:12 AM.. Reason: S O L V E D
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need to generate a file with random data. /dev/[u]random doesn't exist. Devyn Shell Programming and Scripting 7 08-22-2013 10:23 PM
generate a sequence vaibhavkorde Shell Programming and Scripting 4 04-15-2011 11:28 AM
Generate random number luoluo Programming 1 05-16-2010 02:01 AM
Generate Random Password in C vjaws Programming 2 06-11-2008 01:58 PM
Generate a Sequence like in Oracle keshav_rk UNIX for Dummies Questions & Answers 1 03-20-2008 09:43 AM



All times are GMT -4. The time now is 08:46 AM.