LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-20-2007, 02:11 PM   #1
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 33

Rep: Reputation: 16
New lines in terminal


I am learning to use dar from the command line. My dar command is 3 lines long full width of the monitor. Is there a character sequence to insert between commands so that my 3 lines can be broken into more lines? A simple return causes the command not to run.

I searched on line length, man terminal, but was unable to locate what I am looking for.

What I have (example):

-X "*.*.dar" -X "*.jpg" --create /darbu -s 650M -y -v -Z "*.mp3" -Z "*.avi" -Z "*.mpg" -Z "*.mpeg" -Z "*.divx" -Z "*.rm" -Z "*.wmv" -Z "*.wma" -Z "*.asf" -Z "*.ra" -Z "*.gif" -Z "*.jpg" -Z "*.jpeg" -Z "*.png" -Z "*.zip" -Z "*.tgz" -Z "*.gzip" -Z "*.bzip" -Z "*.bzip2" -Z "*.rar" -Z "*.Z" --fs-root / -g home/mike/Desktop/autodealer --prune home/mike/tmp

What I would like:

-X "*.*.dar" -X "*.jpg" --create /darbu -s 650M -y -v
-Z "*.mp3" -Z "*.avi" -Z "*.mpg" -Z "*.mpeg" -Z "*.divx" -Z "*.rm"
-Z "*.wmv" -Z "*.wma" -Z "*.asf" -Z "*.ra" -Z "*.gif" -Z "*.jpg"
-Z "*.jpeg" -Z "*.png" -Z "*.zip" -Z "*.tgz" -Z "*.gzip" -Z "*.bzip"
-Z "*.bzip2" -Z "*.rar" -Z "*.Z"
--fs-root /
-g home/mike/Desktop/autodealer
--prune home/mike/tmp

But there needs to be a break of some type at the end of each line, and it cannot be a carriage return. Any suggestions on search topics?

mg92865
 
Old 12-20-2007, 02:13 PM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Tried '\' already?
 
Old 12-20-2007, 02:43 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
If you put a backslash \ at the end of the line (with no spaces after it), tyu can continue to enter a command on a new line,. e.g.
Code:
echo this is a long command which has \
been split over more than one line
 
Old 12-21-2007, 06:15 AM   #4
mg92865
Member
 
Registered: Jun 2006
Distribution: Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 16
The added \ solved the problem

Hello,

Thank you for the prompt response. Adding the \ solves my
problem.

I have not seen this. I looked for a man terminal page but none
exists on my system. What would I have searched on to find
more on the terminal or the use of "\" in terminal.

Thanks,

mg92865
 
Old 10-28-2012, 06:44 AM   #5
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,440

Rep: Reputation: 80
Quote:
Originally Posted by matthewg42 View Post
If you put a backslash \ at the end of the line (with no spaces after it), tyu can continue to enter a command on a new line,. e.g.
Code:
echo this is a long command which has \
been split over more than one line
How do you insert a newline into the terminal without putting it in a script or copy and paste?
 
Old 10-28-2012, 07:44 AM   #6
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Quote:
Originally Posted by fakie_flip View Post
How do you insert a newline into the terminal without putting it in a script or copy and paste?
Like this:

Code:
echo -e "foo bah\nbaz"
The '-e' flag tells echo to expand newlines, among other things.

Last edited by Snark1994; 10-28-2012 at 07:46 AM. Reason: Forgot the (important!) quotes
 
Old 10-28-2012, 05:58 PM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by mg92865 View Post
I looked for a man terminal page but none
exists on my system.
This is not a "terminal" question, it's a shell syntax one. You need to look in your bash man page, or whatever other shell you use as the default.

Here are a few useful bash references for you:
http://mywiki.wooledge.org/BashGuide
http://wiki.bash-hackers.org/start
http://www.linuxcommand.org/index.php
http://wiki.bash-hackers.org/scripting/newbie_traps
http://mywiki.wooledge.org/BashPitfalls
http://mywiki.wooledge.org/BashFAQ
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://ss64.com/bash/
 
Old 10-29-2012, 03:24 AM   #8
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,440

Rep: Reputation: 80
Quote:
Originally Posted by Snark1994 View Post
Like this:

Code:
echo -e "foo bah\nbaz"
The '-e' flag tells echo to expand newlines, among other things.
No, in the command, not the output.

Quote:
echo this is a long command which has \
been split over more than one line
 
Old 10-29-2012, 05:00 AM   #9
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
I'm not entirely clear what you're asking here, but as above, the syntax of *nix shells is such that a newline is assumed to be the end of a cmd UNLESS you append a '\' at the physical end of the line.

You can print out '\n' if you want to see a new line, and echo can explicitly insert a newline as above or append (-n) instead of (default) putting a newline
eg
Code:
echo -en "foo bah\nbaz"
foo bah
 
Old 10-29-2012, 05:09 AM   #10
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,445

Rep: Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829
Quote:
Originally Posted by fakie_flip View Post
How do you insert a newline into the terminal without putting it in a script or copy and paste?
Press enter, if the shell knows that command isn't finished (because of a backslash or unclosed quote) it will prompt for more input after the newline:
Code:
~/tmp$ echo this is a long command which has \
> been split over more than one line
this is a long command which has been split over more than one line
You can see on the second line the prompt is ">", the value of $PS2.
 
1 members found this post helpful.
Old 10-29-2012, 11:56 PM   #11
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,440

Rep: Reputation: 80
Thank you ntubski. That's what I was looking for.
 
  


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
Rewriting multiple lines in C++ terminal application bandwidthjunkie Programming 4 04-06-2007 09:34 PM
Is there any terminal (xterm,aterm....) with 7000 lines memory/display ? Xeratul Linux - Software 2 11-25-2006 10:19 AM
gnome-terminal how-to set lines/rows? longtex Linux - Software 3 10-21-2005 03:06 PM
weird lines on X window terminal - I'm worried... towsonu2003 Linux - Hardware 8 09-22-2005 03:34 PM
lines remaining when I launch an app or terminal spiteres Linux - General 0 05-27-2003 06:24 AM


All times are GMT -5. The time now is 01:47 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration