LinuxQuestions.org
Help answer threads with 0 replies.
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-24-2006, 12:17 PM   #1
stapletone
LQ Newbie
 
Registered: Sep 2006
Posts: 1

Rep: Reputation: 0
File Creation: bash shell


Hey guys,

Linux newbie here...but how can you create a file in a different directory than the one you are currently in. I'm not so much interested in the method used (cat, vim, etc...) I just cant get the syntax, to, for instance, create a file in the root directory from the /etc directory. Any help is appreciated.
 
Old 09-24-2006, 12:35 PM   #2
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
touch /root/test.txt will create file under root folder.
 
Old 09-24-2006, 01:35 PM   #3
got_nix
Member
 
Registered: Oct 2004
Location: Jamaica
Distribution: Ubuntu 6.0.6 (Dapper Drake)
Posts: 59

Rep: Reputation: 15
yeh touch works. or you can can even use your favourite editor example

gedit /root/testfile.txt (as su) and then save the file and your done.. touch makes more sense if you just creating. gedit/vi/nano/pico makes sense if you need to ad something to the file right away
 
  


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
BASH Shell Scripting -- foreach file in folder??? AC97Conquerer Programming 11 07-06-2011 01:25 AM
Bash: how to get time (in seconds) elapsed since creation of a file? J_Szucs Linux - General 6 12-28-2008 12:28 AM
end of file in bash shell manojg Linux - Newbie 4 03-09-2006 11:11 AM
bash:output file names from shell script to vi sickboy Linux - Newbie 6 10-14-2004 04:40 AM
systemwide bash login shell cleanup file markus1982 Linux - General 2 05-10-2003 09:35 AM


All times are GMT -5. The time now is 08:48 AM.

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