Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Why does 'kate mytextfile' work, but 'mytextfile | kate' doesn't?
A pipe connects the output of one command to the input of the next.
"mytextfile" does not produce any output---it actually does nothing. to prove this, just type it in at a prompt.
The first example works because the kate command is set up to handle what are called "command-line arguments"
If you like to experiment, try entering:
"cat mytextfile | <somecommand>" This reads the content of mytextfile and gives it to <somecommand>
A common usage would be "cat mytextfile | grep hello"
This prints any line from the file that contains the word "hello"
Pipes are often used with a type of program called a filter. Grep, sed, tr & awk are common filters. They are placed after a pipe, taking the standard input from the pipe and printing the result to the standard output.
Another type of program like kate, or kghostview expect a filename argument. Some of these will accept the "-" dash character argument as a signal to take the input from standard input.
For example, try:
man -t bash | kghostview -
Then read page 5 to learn about pipes!
Or suppose that you want a text file output:
man bash | cat >bash.txt
A program such as "enscript" will be setup to write a file instead of sending the output to stdout.
With enscript and others you can use the output filename of "/dev/stdout" to generate a stdout stream.
man bash | enscript -o /dev/stdout >bash.ps
man bash | enscript -o /dev/stdout | kghostview -
A handy command to learn is "xargs". This command will take the standard output of a pipe and use them as arguments to another command.
Just minutes ago, I used pipes to take the contents of the unziped .k3b file to get the filelist of files I backed up to cdrom.
The resultant maindata.xml contains the filenames that were backed up. So I can delete them like this:
sed -e '/^<url>/!d'-e 's/<url>\(.*\)<\/url>/\1/' -e 's/\&/\\&/' maindata.xml | tr '\n' '\000' | xargs -0 rm -v
The sed commands extract just the filenames from the xml file and escape an "evil" character in the filenames. The tr command replaces newlines with nulls. The -0 option to xargs tells it to use nulls instead of returns. This helps with filenames that contains spaces. These filenames are used as arguments to the "rm" command and are deleted.
ImageMagick is a package of several programs. One of them will combine photos.
I think the program you want is called mogrify.
mogridy (sic) - resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites
the original image file, whereas, convert(1) writes to a different image file.
For more information about this command, point your browser to file:///usr/share/doc/packages/ImageMagick/index.html.
Run `mogrify -help' to get a summary of the mogrify command options.
cs-cam > The reason that doesn't work is obvious but I can't think of a decent way of explaining them so here's a link...
Yup, thanks... It is indeed obvious to me too, now that I've been using Linux a month longer (and having taken this long to check this thread).
That's good, though... If such originally-confusing stuff seems so simple now, it means there's hope for all of us as we confront the truly hard stuff. (Er, if anybody understands what I just said, explain it to me, okay?)