Mcookie, pkg -l to generate random sequence


 
Thread Tools Search this Thread
Operating Systems BSD Mcookie, pkg -l to generate random sequence
# 1  
Old 10-07-2015
(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 11:12 AM.. Reason: S O L V E D
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to generate sequence of numbers

I need awk script to generate part number sequencing based on data in multiple columns like below Input File --------- Col A|Col B|Col C| 1|a|x| 2|b|y| |c|z| | |m| | |n| And out put should be like 1ax 1ay 1az 1am 1an 1bx 1by (6 Replies)
Discussion started by: aramacha
6 Replies

2. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies

3. Shell Programming and Scripting

generate random base 16

How would you use bash to generate a random 32 digit number base 16? Like this one: 0cc06f2fa0166913291afcb788717458 (8 Replies)
Discussion started by: locoroco
8 Replies

4. Shell Programming and Scripting

generate a sequence

how can i generate following sequence for a given input 1,2,3,4,5 1->2 2->3 3->4 4->5 1->2,3 1,2->3 2->3,4 2,3->4 3->4,5 3,4->5 1->2,3,4 1,2->3,4 1,2,3->4 (4 Replies)
Discussion started by: vaibhavkorde
4 Replies

5. Programming

Generate random number

I saw this formula to generate random number between two specified values in shell script.the following. $(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min)) Give a example in book. Generate random number between 6 and 30.like this. $(((RANDOM%30/3+1)*3)) But I have a... (1 Reply)
Discussion started by: luoluo
1 Replies

6. Programming

Generate Random Password in C

I need a function to generate a random alphanumeric password in C code. It needs to be between 6-8 characters and follow the following rules: Reject if same char appears # time: 4 or more Reject if same char appears consecutively: 3 or more I have the following random password working for... (2 Replies)
Discussion started by: vjaws
2 Replies

7. UNIX for Dummies Questions & Answers

Generate a Sequence like in Oracle

#!/usr/bin/ksh ValUniqueNo=0 export ValUniqueNo FnGenerateUniqueNo() { (( ValUniqueNo = $ValUniqueNo + 1 )) echo $ValUniqueNo export ValUniqueNo=$ValUniqueNo } echo k1=`FnGenerateUniqueNo` echo k2=`FnGenerateUniqueNo` kindly consider the above script. it is required that when... (1 Reply)
Discussion started by: keshav_rk
1 Replies

8. UNIX for Dummies Questions & Answers

how can i isolate the random sequence of numbers using awk?

as you can see there is a delimiter after c8 "::". Awk sees the rest as fields because it doesn't recognize spaces and tabs as delimiters. So i am basically looking to isolate 20030003ba13f6cc. Can anyone help? c8::20030003ba13f6cc disk connected configured unknown (2 Replies)
Discussion started by: rcon1
2 Replies

9. Shell Programming and Scripting

Generate a random password

Hello All... Can someone help me generate a random password which will be 7 characters long which contains alpha-numeric characters using shell script. I am looking to store the output of the script that generates the password to a variable within a script and use it as the password. ... (5 Replies)
Discussion started by: chiru_h
5 Replies

10. Programming

How to generate a random number?

How to generate a random integer with specific range(for example, from 1 to 1000)? Also, how to convert a floating point number into a integer? (2 Replies)
Discussion started by: MacMonster
2 Replies
Login or Register to Ask a Question