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-09-2008, 10:34 AM   #1
lelmo82
LQ Newbie
 
Registered: Feb 2008
Location: South Carolina
Distribution: Fedora 9 Ubuntu 8.10
Posts: 25
Blog Entries: 1

Rep: Reputation: 15
Inserting code snippets in posts


Someone please point me at instructions for inserting code snippets into posts. Thanks and please excuse my abject ignorance. Les
 
Old 12-09-2008, 10:40 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hi Les. You have to use CODE tags. You can either go in advanced mode (see the button Go Advanced at the bottom of the Quick Reply box), select the text you want to embed in code tags and press the hash button (#). Or you can explicitly put code tags around the text, like this:

[CODE]This will be a code snippet![/CODE]

resulting in
Code:
This will be a code snippet!
 
Old 12-09-2008, 12:23 PM   #3
lelmo82
LQ Newbie
 
Registered: Feb 2008
Location: South Carolina
Distribution: Fedora 9 Ubuntu 8.10
Posts: 25
Blog Entries: 1

Original Poster
Rep: Reputation: 15
code snippets in posts

Many thanks for reply! Now dumb question #2: How do I Copy/Paste a long coded file from my Operationg systems (Fedora 9, Ubuntu 8.10?) I hope (and I am sure you do also) that this is my last question. Again,many thanks!
 
Old 12-09-2008, 12:42 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Well... just copy and paste using the mouse buttons: select with the left-button, paste with the middle-button. Hmmm... maybe this is not the kind of answer you expected. More seriuosly, if you have a long code or a text file in general or a long output from a command, you can copy it using the xsel command.

xsel is an application that is not usually available in the default installation of Linux, but there should be a package available for Debian-based systems. Anyway the compilation from source is very straightforward. Once you have xsel installed you can "copy" the content of a file using
Code:
xsel < testfile
then use the middle mouse button to paste. You can also "copy" the very long output of a command using process substitution, for example
Code:
xsel < <(ls -lR /)
then paste in the usual way. Look for details about xsel on the developer's web page.
 
  


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
LXer: Finding the right software code snippets quickly LXer Syndicated Linux News 0 10-18-2007 02:41 AM
Txt Edr.- HTML- Custom Saved Code "Snippets" WhatsOnYourBrain Linux - Software 1 04-01-2007 04:36 PM
LXer: Nvidia posts graphics code tweaking tool LXer Syndicated Linux News 0 10-20-2006 08:33 PM
where can i find good c source code snippets tacca Programming 2 06-02-2006 04:12 AM
Shortcut keys for inserting text/code in Linux Horos23 Programming 1 02-03-2005 04:50 PM


All times are GMT -5. The time now is 02:07 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