LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-28-2012, 10:42 PM   #1
natedogg18
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
how to create a file with data


hi im new to linux. and this is a very basic question that im stuck with. i got a question on an assignment recently that asks for a single line command to create a file called current and that contains a list of current users. i only kno the touch and cat > commands to create a file.
 
Old 09-28-2012, 10:57 PM   #2
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Jessie
Posts: 592

Rep: Reputation: 119Reputation: 119
Since it's a homework question, I'll give you some pointers instead of a direct answer.

A simple search on your favorite search engine with the terms How to get a list of logged on users on Linux will give to command to retrieve a list of currently logged on users.

You can then use redirection to save the list to a file. Redirection allows you re-direct the output of a command to one or more file descriptors, which in your case would be a text file.

Here are some links:
http://www.gnu.org/software/bash/man...l#Redirections
http://mywiki.wooledge.org/Redirection
 
Old 09-29-2012, 12:21 AM   #3
natedogg18
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
oh ok. i got it now. thanks a lot for the info
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I didn't create data file the 1st time - can I do it now? Slacko Puppy ejoanie Linux - Newbie 0 06-18-2012 08:01 PM
[SOLVED] extract directory and xml data to create a comma delimited file j-me Programming 33 05-10-2012 09:57 AM
How to Create sparse file with alternate data and hole. mango7 Programming 4 10-13-2011 09:02 AM
Create File Shell Syntax and pass data to the file FirstBorn Linux - General 22 07-31-2008 10:48 PM
use script to create a data file of mulitple users RajRed Linux - Newbie 4 11-27-2007 07:05 PM


All times are GMT -5. The time now is 04:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration