LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2021, 01:35 PM   #1
claire80
LQ Newbie
 
Registered: Mar 2021
Posts: 11

Rep: Reputation: Disabled
Unable to get my command to work


What does this command do?

command base64 /dev/urandom | head -n 700 > NewFile.txt
 
Old 03-27-2021, 01:54 PM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Where did you find this command? What are you trying to achieve?
 
Old 03-27-2021, 02:12 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,312
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Quote:
Originally Posted by claire80 View Post
What does this command do?

command base64 /dev/urandom | head -n 700 > NewFile.txt
Well, the base64 and head are programs, so the'll have reference manuals:

Code:
man base64
man head
The first one converts binary data to a text-encoding suitable for certain situation.
The | pipe character takes the output from the first program and sends at input to the second.
The second program, with the -n 700 option, takes the first 700 lines and then stops.

The first file, /dev/urandom, is a connection from the kernel's random number source device.
The second file, NewFile.txt, is just a regular file which will contain the above mentioned 700 lines by virtue of a shell redirection indicated by the > operator. See also chapter 6 of the book The Linux Command Line.

In short, the line you ask about will produce a file containing 700 lines of random letter, numbers, and a few symbols.

Last edited by Turbocapitalist; 03-27-2021 at 02:20 PM.
 
Old 03-27-2021, 02:19 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Two threads started so far with questions which look like homework.
 
Old 03-28-2021, 07:33 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,798

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
One more thing to mention:
when the second command terminates then it closes the pipe.
Then the first command gets a SIGPIPE that tells it to terminate.
 
1 members found this post helpful.
Old 03-28-2021, 07:45 AM   #6
claire80
LQ Newbie
 
Registered: Mar 2021
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thank you everyone for all your help. all done now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [SOLVED] bash script: can echo command, command works if I type, but command doesn't work in script ... why? hopeless_n00b Linux - Newbie 10 07-12-2018 05:57 AM
sendmail is unable to get access to the outside world? unable to send email? cyberdome Linux - Server 25 04-02-2014 10:40 AM
unable to get the Gui,Dell Vostro 1310,unable to get the Gui after installing RHEL 5 getasif Linux - Laptop and Netbook 1 09-06-2009 05:46 PM
ethernet unable to work w/o command modprobe ziggie216 Linux - Hardware 1 12-05-2005 12:54 AM
Get the Butterfly!!! Get it! Get it! Get it! rmartine General 6 01-11-2004 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration