Life on the Command Line

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Life on the Command Line

#1 Post by Dougal »

This is rather interesting.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

tlchost
Posts: 2057
Joined: Sun 05 Aug 2007, 23:26
Location: Baltimore, Maryland USA
Contact:

Re: Life on the Command Line

#2 Post by tlchost »

Dougal wrote:This is rather interesting.
Heavens...what a radical thought from the article
I also don’t do this out of some perverse hipster desire for retro-computing. I have work to do. If my system didn’t work, I’d abandon it tomorrow.

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#3 Post by nooby »

Just about everything I do, I do exclusively on the command line.
And I do what everyone else does: manage email, write things,
listen to music, manage my todo list, keep track of my schedule,
and chat with people. ...

... whatever the case, I do all of it on the lowly command line.
I literally go for months without opening a single graphical desktop application.
In fact, I don’t – strictly speaking – have a desktop on my computer.

I think this is a wonderful way to work.
Jay more power to him. And him not alone at all. And this is old news.
Around 1989 or so I was member of a local Computer Club.
The Chair of that Committee was a Unix Guru and him too never
used a graphic interface ever. :)

Who needs a GUI when one have a CLI :)

(Just friendly teasing. I hate to use the CLI, because I am computer challenged)
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
plankenstein
Posts: 120
Joined: Sun 16 Nov 2008, 00:49
Location: Arkansas, USA

#4 Post by plankenstein »

VERY interesting. Kinda makes me nostalgic for the old days when I first started out with dos and and basic and cobol and ... You get the idea. Maybe I'll try out a few cli apps when I get the chance and see if I agree with him.
I carefully plan ALL my random acts! :lol:

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#5 Post by puppyluvr »

:D Hello,
I have to thank BruceB for pushing me into the CLI..
It is easier, and faster, for many things..
A simplified example..
Which is easier?
1 Opening MPlayer, clicking file, clicking open, navigating to a directory, and selecting a song to play...
2 Opening a terminal and typing
mplayer /mnt/home/music/riot.mp3
Type mplayer --help in a terminal... You might be surprised what all it can do..

I use mplayer as an example, but the cli opens up a lot of otherwise overlooked possibilities...

The "which" command is very useful...
GNU/Linux has many core utilities accessible only through the cli...

split/md5sum/modprobe/etc....
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

Bruce B

#6 Post by Bruce B »

We could call it the command line and that would be the right word to use.

I suppose I use the command line as much or more than any of us.

Am I using the command line? By all means. But what I'm really using to do it is the keyboard.

It would be fair to say I'm a keyboard user.

Back in the days when WordPerfect 5.1 was the class act in word processors, we find that although it had icons and mouse controls, most everyone proficient with it used the keyboard.

We have two basic input devices. These are the keyboard and the mouse. I find the mouse requires a finer more controlled dexterity than the keyboard. I think it is also slower. Can you click 45 icons and menus a minute without mistakes? Can you type 45 words a minute without mistakes?

If I want to start Photoshop, I type pshop. I can type pshop faster and easier than I can navigate the menu and launch Photoshop.

If I want to change directories to /mnt/sda8/videos, I type videos. I can do this faster and easier than any other way I could imagine.

When it comes to scripts, most of my scripts can do things no GUI was designed to do.

Suppose I want to name a batch of photos to Yellowstone_July_2011_01.jpg

I change to the directory and type
jren yellowstone july 2011

then I get

Yellowstone_July_2011_01.jpg
Yellowstone_July_2011_02.jpg
Yellowstone_July_2011_03.jpg
Yellowstone_July_2011_04.jpg
Yellowstone_July_2011_05.jpg


I'm not a particularly fast computer operator, but if people watched me, they'd think I am.

It's because keyboarding can be very fast and easy.

~

Bruce B

#7 Post by Bruce B »

puppyluvr

Here is an example of how I play .mp3 files. Because of all the options, it took a lot of testing to come up with the set I like the best.

Code: Select all

#!/bin/bash

. /root/.mpg/mpgopts

if [ $1 ] ;then
   fullnice --adjustment=-19 mpg123 $mpgopts  "$@" 
else
    fullnice --adjustment=-19 mpg123 $mpgopts --list playlist.txt "$@" 
fi
The script is simple, here is the opts file I source.

Code: Select all

mpgopts=" \

--buffer 32768 \
--control \
--cpu 3DNowExt \
--delay 2 \
-E /root/.mpg/eq \
--float \
--fuzzy \
--index \
--no-gapless \
--output alsa \
--rate 44100 \
--reopen \
--resync-limit -2 \
--scale 65536 \
--stereo \
--title"

#--cpu 3DNow \


#    --list $playlist plain"
#    --smooth \
#    --rate 44100 \
#    --buffer 66536 \ I made it huge
#    --loop 0 \ doesn't work with playlist
#    --smooth \ might be good but I'll leave it out now
#    --title \
#    --no-gapless \
#    --skip 2048 \

# High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
#   version 1.13.2; written and copyright by Michael Hipp and others
#   free software (LGPL/GPL) without any warranty but with best wishes
#
# usage: mpg123 [option(s)] [file(s) | URL(s) | -]
#
# input options
#
#  -k <n> --skip <n>         skip n frames at beginning
#         --skip-id3v2       skip ID3v2 tags without parsing
#  -n     --frames <n>       play only <n> frames of every stream
#         --fuzzy            Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC)
#  -y     --no-resync        DISABLES resync on error (--resync is deprecated)
#  -p <f> --proxy <f>        set WWW proxy
#  -u     --auth             set auth values for HTTP access
#         --ignore-mime      ignore HTTP MIME types (content-type)
#  -@ <f> --list <f>         play songs in playlist <f> (plain list, m3u, pls (shoutcast))
#  -l <n> --listentry <n>    play nth title in playlist; show whole playlist for n < 0
#         --loop <n>         loop track(s) <n> times, < 0 means infinite loop (not with --random!)
#         --keep-open        (--remote mode only) keep loaded file open after reaching end
#         --timeout <n>      Timeout in seconds before declaring a stream dead (if <= 0, wait forever)
#  -z     --shuffle          shuffle song-list before playing
#  -Z     --random           full random play
#         --no-icy-meta      Do not accept ICY meta data
#  -i     --index            index / scan through the track before playback
#         --index-size <n>   change size of frame index
#         --preframes  <n>   number of frames to decode in advance after seeking (to keep layer 3 bit reservoir happy)
#         --resync-limit <n> Set number of bytes to search for valid MPEG data; <0 means search whole stream.
#         --streamdump <f>   Dump a copy of input data (as read by libmpg123) to given file.
#         --icy-interval <n> Enforce ICY interval in bytes (for playing a stream dump.
#
# output/processing options
#
#  -o <o> --output <o>       select audio output module
#         --list-modules     list the available modules
#  -a <d> --audiodevice <d>  select audio device
#  -s     --stdout           write raw audio to stdout (host native format)
#  -S     --STDOUT           play AND output stream (not implemented yet)
#  -w <f> --wav <f>          write samples as WAV file in <f> (- is stdout)
#         --au <f>           write samples as Sun AU file in <f> (- is stdout)
#         --cdr <f>          write samples as raw CD audio file in <f> (- is stdout)
#         --reopen           force close/open on audiodevice
#         --cpu <string>     set cpu optimization
#         --test-cpu         list optmizations possible with cpu and exit
#         --list-cpu         list builtin optimizations and exit
#         --test-3dnow       display result of 3DNow! autodetect and exit (obsoleted by --cpu)
#         --force-3dnow      force use of 3DNow! optimized routine (obsoleted by --test-cpu)
#         --no-3dnow         force use of floating-pointer routine (obsoleted by --cpu)
#  -g     --gain             [DEPRECATED] set audio hardware output gain
#  -f <n> --scale <n>        scale output samples (soft gain - based on 32768), default=32768)
#         --rva-mix,
#         --rva-radio        use RVA2/ReplayGain values for mix/radio mode
#         --rva-album,
#         --rva-audiophile   use RVA2/ReplayGain values for album/audiophile mode
#  -0     --left --single0   play only left channel
#  -1     --right --single1  play only right channel
#  -m     --mono --mix       mix stereo to mono
#         --stereo           duplicate mono channel
#  -r     --rate             force a specific audio output rate
#  -2     --2to1             2:1 downsampling
#  -4     --4to1             4:1 downsampling
#         --pitch <value>    set hardware pitch (speedup/down, 0 is neutral; 0.05 is 5%)
#         --8bit             force 8 bit output
#         --float            force floating point output (internal precision)
#  -e <c> --encoding <c>     force a specific encoding (s16 u16 u8 s8 ulaw alaw f32 s32 u32 s24 u24)
#  -d n   --doublespeed n    play only every nth frame
#  -h n   --halfspeed   n    play every frame n times
#         --equalizer        exp.: scales freq. bands acrd. to 'equalizer.dat'
#         --gapless          remove padding/junk on mp3s (best with Lame tag)
#                            This is on by default when libmpg123 supports it.
#         --no-gapless       disable gapless mode, not remove padding/junk
#  -D n   --delay n          insert a delay of n seconds before each track
#  -o h   --headphones       (aix/hp/sun) output on headphones
#  -o s   --speaker          (aix/hp/sun) output on speaker
#  -o l   --lineout          (aix/hp/sun) output to lineout
#  -b <n> --buffer <n>       set play buffer ("output cache")
#         --preload <value>  fraction of buffer to fill before playback
#         --smooth           keep buffer over track boundaries
#
# misc options
#
#  -t     --test             only decode, no output (benchmark)
#  -c     --check            count and display clipped samples
#  -v[*]  --verbose          increase verboselevel
#  -q     --quiet            quiet mode
#  -C     --control          enable terminal control keys
#         --title            set xterm/rxvt title to filename
#         --long-tag         spacy id3 display with every item on a separate line
#         --utf8             Regardless of environment, print metadata in UTF-8.
#  -R     --remote           generic remote interface
#         --remote-err       force use of stderr for generic remote interface
#         --fifo <path>      open a FIFO at <path> for commands instead of stdin
#         --aggressive       tries to get higher priority (nice)
#  -T     --realtime         tries to get realtime priority
#  -?     --help             give compact help
#         --longhelp         give this long help listing
#         --version          give name / version string
#
# See the manpage mpg123(1) for more information.
Then we have the equalizer file

Code: Select all

1.6 1.6        
1.6 1.6        
1.5 1.5        
1.5 1.5        
1.4 1.4        
1.4 1.4        
1.4 1.4        
1.3 1.3        
1.3 1.3        
1.3 1.3        
1.2 1.2        
1.2 1.2        
1.1 1.1        
1.1 1.1        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.0 1.0        
1.4 1.4       
1.5 1.5        
1.6 1.6        
1.7 1.7       
1.8 1.8        
1.9 1.9
Then we have the careful setting of the gain on each file and setting alsa volumes for maximum sound quality to suit the changes.

Also, I often like to remove the predictibility of song playback sequence so I have a routine to randomize the songs.

Code: Select all

#!/bin/bash
for i in $1*.mp3 ; do
    printf "%05d $i\n" $RANDOM  >> ${TMPDIR}/random1.tmp
done

cat  ${TMPDIR}/random1.tmp | sort >> ${TMPDIR}/random2.tmp

<${TMPDIR}/random2.tmp sed -r 's/^[0-9]+ //' > playlist.txt

rm ${TMPDIR}/random1.tmp ${TMPDIR}/random2.tmp
Any single script is simple, but it did take a while coming up with the combinations and what sound I like best.

Once done, I merely need to cd to the mp3 directory and type mpg2

This places a window on the screen showing the song playing along with the keyboard shortcuts to change songs or replay and etc.

There just isn't a GUI to do it. Moreover each script system needs fine tuning for your songs and equipment.

And there is nothing faster or easier.

Scripting adds so much capablility to Linux, people who haven't taken the time to learn, just aren't getting out of their OS what they could.

And thanks for the acknowledgement. I'm glad I helped someone have a better expreience in terms of thier computing.

~

PS it's also kind on resources

Bruce B

#8 Post by Bruce B »

plankenstein wrote:VERY interesting. Kinda makes me nostalgic for the old days when I first started out with dos and and basic and cobol and ... You get the idea. Maybe I'll try out a few cli apps when I get the chance and see if I agree with him.
It is about people working together.

The command line was very natural for me. Bash was fairly easy. It only has a few internals and you don't need to know the caveats of all of them.

The harder part if all the command line utilities our Linux distros come with. We need to learn many of them. And again, we don't need to know all of their nuances.

To me computing is a task oriented think. I want to perform a task. This task is posting you. I know how to do it so no problem.

Other tasks were not so easy, not a first. My tendency when I ran into a hard task was to boot into Windows and perform it.

I broke myself of this habit by deleting Windows. Thereafter, every task I wanted to perform I did in Linux. This really helped me learn, because if it was going to get done, Linux was the only OS.

Then one day, I wanted to perform a task and could not figure it out to save my soul. I'd still like to know how.

I bought some Sandisk sticks and they had some kind of U3 or something on it. I couldn't remove them or figure out how. But I just didn't want them.

So I installed Windows and some software to remove those things and that is the only time I couldn't do everything in Linux.

Having achieved my goal of learning Linux to my satisfaction, I left Windows in place and installed some software. I don't use it much.

One external utility which was hard for me was sed. I think I got a bad tutorial and just had a tough time with it. Maybe a mental block.

I worked around it by writing C programs to do things I should have been doing with sed.

Then I got bold enough to say I just didn't get some things. One of our members, Shep is an expert on sed and he did a lot to help me. Now sed makes a lot of sense and I have good references.

My points to you are: None of us were born with any knowledge of Linux. There are an unbelievable number of talented and helpful people on this list. If you have the desire to learn and have courage to ask questions and participate with your helpers in the help you get, you will learn very fast.

Bruce

~

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#9 Post by nooby »

May I ask a very noob question.

Urxvt or Console Terminal is not really CLI is it?

Is it not some kind of emulator?

The real CLI is if we do Menu > Shutdown > Exit to prompt.

that is the real CLI or Command Line Interface? I am not sure but ???

Now the good thing with the emulator Urxvt is that it has a built in memory and it save it in pupsave too so when we reboot the machine it does remember the very long lines we wrote into it some days ago.

That way one only have to use the Up Arrow key and it can list one by one all the input we have made.

What about the real Command line Prompt. Does it have such recall too?
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#10 Post by puppyluvr »

:D Hello,
Yes, in fact if you run commands in rxvt, drop out of X to the #, and hit up arrow, they are all stored there for you.. It is the same, except rxvt "emulates" the prompt, inside the GUI.
Saves a lot of remembering/typing..
Like, for example, to install a proprietary video driver, I copy and paste it into rxvt, and run it.. It will not work, but after it tells me so, I drop out of X, hit up arrow, and there is all the text I copied, ready to go..
Saves remembering the exact name and typing it in..
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#11 Post by L18L »

nooby wrote: The real CLI is if we do Menu > Shutdown > Exit to prompt.

that is the real CLI or Command Line Interface? I am not sure but ???
Without Exit to prompt:
try Ctrl Alt F2

back to xwin: Ctrl Alt F4
use F4 if you have 3 virtual desktops
use F3 if you have 2 virtual desktops

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#12 Post by nooby »

Thanks guys, yes very cool that it does remember.

the sad thing is that the middle key on the Mouse is odd to use.

I mark what I want to copy and paste in Urxvt and then hit middle which on my is a wheel that can be treated like a middle key.
okay it put it all in some buffer or what the name is.

then I can go here and show the result of some action.

But if the text is a lot of output then all of that is also in that memory so it clutter up it immensely :)
I use Google Search on Puppy Forum
not an ideal solution though

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#13 Post by PaulBx1 »

We have two basic input devices. These are the keyboard and the mouse.
I remember when I first saw a mouse. Some guy was using it with this tiny little computer called a Mac. That was back when there was only one input device (if you don't count card readers and paper tape readers!), the keyboard. We were working with PDP-11's and Data General Novas.

My brother bought a Mac early on for his business. No one told him how to use the mouse. One day he took his stuff to a printer and and used the computer there to transfer his files from the floppy. The printer looked at him using the mouse and said, "What the hell are you doing!?" My brother had taught himself to manipulate the mouse backwards, with the "tail" running under his wrist. :lol:

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Re: Life on the Command Line

#14 Post by Dougal »

tlchost wrote:
Dougal wrote:This is rather interesting.
Heavens...what a radical thought from the article
I can't figure out what you're being sarcastic about... I must say that considering how people demands from their OS these days are to (i) run games and (ii) play flash videos, that is pretty radical... (not to mention all the people who sit at work and, rather than working, read blogs and hand out on forums)
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#15 Post by Dougal »

puppyluvr wrote: It is easier, and faster, for many things..
I think the combination of Rox+CLI is best... using the keyboard to select files etc. in Rox and then just hitting "!" to get the Rox shell and operate on them, or hitting "`" in a directory to get a terminal is more efficient than playing with GUIs. Not to mention the horror of file open dialogs -- my file open dialog is Rox.

An important part that people miss when they dismiss the CLI is the fact that every operation you perform regularly can be automated! I just create a script in /root/my-applications/bin, give it a name that starts with a capital letter (for easy tab-completion), then just make it do the job for me...
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

tlchost
Posts: 2057
Joined: Sun 05 Aug 2007, 23:26
Location: Baltimore, Maryland USA
Contact:

Re: Life on the Command Line

#16 Post by tlchost »

Dougal wrote:
tlchost wrote:
Heavens...what a radical thought from the article
I can't figure out what you're being sarcastic about.
Simply the fact that so many people seem not to use their computers for tasks....and as you read, the author made a point of saying that's how he used the computer.

User avatar
faifpuhp
Posts: 97
Joined: Thu 22 Sep 2011, 06:12

Re: Life on the Command Line

#17 Post by faifpuhp »

tlchost wrote:Heavens...what a radical thought from the article
I also don't do this out of some perverse hipster desire for retro-computing. I have work to do. If my system didn't work, I'd abandon it tomorrow.
I think it would be more accurate to say: "
I also don't do this out of some FUN hipster desire for retro-computing. I have work to do."

Well fine, Mr. Fancy Pants, but computers are for having fun, too... Still I'm glad he can get stuff done.
[url=http://murga-linux.com/puppy/viewtopic.php?p=566477#566477][b]Strawberry is dead[/b][/url][b]![/b]

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#18 Post by 8-bit »

I thought I would jump in here and make a comment on using the command line in rxvt/urxvt to list fiiles and directories.
Did you know that in a terminal, in X or outside of X you can interchange the use of "ls" (linux command) and "dir" (dos command)?
Is this to make windows converts comfortable?

User avatar
faifpuhp
Posts: 97
Joined: Thu 22 Sep 2011, 06:12

#19 Post by faifpuhp »

8-bit wrote: Is this to make windows converts comfortable?
Maybe, but it's not the case with every distro. Most Ubuntu-based distros probably have this shortcut, but it's not that helpful since it might disappear and the switches are totally different.
[url=http://murga-linux.com/puppy/viewtopic.php?p=566477#566477][b]Strawberry is dead[/b][/url][b]![/b]

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#20 Post by 8-bit »

I remember from my Atari days of playing with a very retro emulator where the interface was 8 flip switches. You would enter code using them to make a program and then run it.
Also, for quite a while, I also used the command line and actually had an adversion to using the mouse.

My achievement in those days was writing a font converter that would convert a font set character by character rotated 90 degrees for download to a citoh dot matrix computer.
Could I do that again?
Probably not!

Post Reply