Please post your simple tricks you know but others don't

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
john biles
Posts: 1458
Joined: Sun 17 Sep 2006, 14:05
Location: Australia
Contact:

Please post your simple tricks you know but others don't

#1 Post by john biles »

Hello Everyone,
Even those you'd think would know everything there is to know about Linux and Puppy might not know or remember even what you'd call the "Linux Basics" even a newbie would know that!

Here's an example I'd forgot about ldd what is ldd well if you open a terminal in a folder with say libflashplayer.so ldd will tell you what dependencies libflashplayer.so requires to work correctly.

Forum members dawnsboy and Michalis reminded me of that and this got me thinking "Knowledge is Power" lets get these little what you might call simple tips down in a forum post for everyone to read and learn.

Lets say that new forum member "boo" reads your tip and discovers through learning and experiment like I did how to get an app working, gets the satisfaction like I did and gets hooked and searches to learn more here on the forum as well as on the web and other forums.

Now a year or two pass by and "boo" has become quite the Linux expert and through a twist of fate answers a post you have made providing you with the required fix you need all because of the simple tip you posted.

So lets get posting and improve everyone's knowledge including your own.
Legacy OS 2017 has been released.

User avatar
omskates
Posts: 252
Joined: Thu 03 Sep 2009, 06:50
Location: TriCities, WA

#2 Post by omskates »

I'm just posting a reply to boink up this thread because its great :)

I don't have a tip though :( Wait...quick file managing for the gui lover: Open up multiple file manager windows for easy drag & drop. Learn your file pathways.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#3 Post by sc0ttman »

yes, this thread is a good idea...

I have no real tips, other than something i learned recently..

to get and use variables from files in bash or the terminal, type

Code: Select all

. /path/to/FILENAME
echo $VAR


this will show 'hello' if the file called FILENAME above contains

Code: Select all

VAR=hello
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

G0XAN
Posts: 31
Joined: Fri 08 May 2009, 18:52
Location: Brighton, UK

#4 Post by G0XAN »

I think my favourite tip about Linux is that just about everything appears in the filesystem. There is some useful stuff in there!

For example, /proc gives access to a load of system info. This knowledge allows me to monitor the DC input to my elderly laptop with very unwell battery and pop up a dialog box to warn if the power lead falls out, before the battery dies.

Second tip is to put this script in /root/Startup/ - any executable in this directory will run when the system starts.

This script may be specific to this Toshiba laptop, but digging around in /proc/acpi/ should reveal where the useful parts are for your system.

Code: Select all

#!/bin/bash
# AC Power monitoring script
# This script monitors the AC power connection every 30 seconds
# and pops up a message box if the power is disconnected

# AC Power state is available in:    /proc/acpi/ac_adapter/ADP1/state
# Power disconnected, file contains: state:<spaces>off-line
# Power connected, file contains:    state:<spaces>on-line

# define script name for use in dialog box titles
cScriptName=${0##*/}

while [ 0 ] # repeat for ever
do
	if grep -q off-line /proc/acpi/ac_adapter/ADP1/state
	then
		vMessage="Mains power failure!"
		Xdialog --left --title $cScriptName --msgbox "$vMessage" 10 50
	fi
 	sleep 30 # sleep for 30 seconds
done
Gary

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#5 Post by 01micko »

Hi

Many people don't know how to upload a text file to the forum quickly and easily. Consequently we often get some very long posts. The forum will accept .gz and .zip files as attachments. So the quickest and easiest way I find to compress a single file is with gzip.

To gzip a file open a terminal (usually rxvt or urxvt in Puppy). If your file is in your "/root" directory type:

Code: Select all

gzip /root/myfile
where my file is the file you want to zip.
This is great for long log files so others more knowledgeable can help you with your issues.

Conversly, if you download a "gzip" file , say myfile.gz, it will probably be saved in "/root/my-documents" or "/root/downloads". Unzip it in a terminal emulator with:

Code: Select all

gunzip /root/my-documents/myfile.gz
and the file will be extracted in /root/my-documents. Obviously you replace "my-documents" with "downloads" if it is in /root/downloads.

HTH
Puppy Linux Blog - contact me for access

User avatar
droope
Posts: 801
Joined: Fri 01 Aug 2008, 00:17
Location: Uruguay, Mercedes

#6 Post by droope »

Sometimes, we execute files just by tiping, for example, "firefox" on console. When we need to make a shortcut, sometimes we need the full path.

In those cases, instead of searching manually, one can do the following:

in console
which firefox
And it will tell you.

Cheers!
Droope
What seems hard is actually easy, while what looks like impossible is in fact hard.

“Hard things take time to do. Impossible things take a little longer.â€￾ –Percy Cerutty

[url=http://droope.wordpress.com/]Mi blog[/url] (Spanish)

linbie
Posts: 64
Joined: Sat 09 Jan 2010, 05:03

A simple trick - Power Off shortcut

#7 Post by linbie »

I asked the question in the beginners forum here about a shortcut for power off button on the desktop.

It works well

[/img]

linbie
Posts: 64
Joined: Sat 09 Jan 2010, 05:03

Desktop shortcut to website

#8 Post by linbie »

Right click the browser icon

Select "edit item"

If you add the website address to the "arguments to pass" line then the browser will open at that website.

I have two browser icons - one labeled "browser" which opens to my home page (i.e the arguments line is blank) and the other is labelled "google docs" and opens directly into google docs

Unfortunately the executable file is the same for both (or more) and as such the icon is the same.

The example in the attached image would open the browser directly to E-Bay
Attachments
DirectBrowser.jpg
The browser opens directly to E-Bay
(21.01 KiB) Downloaded 3906 times
Linbie (LINux newBIE)

Dell Inspirion 2500, 900MHz Celeron, 20GB HDD, 128MB RAM, CD/DVD Player, Netgear USB wireless adapter

Puppy 4.3.1 frugal dual boot with WIN XP

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#9 Post by DMcCunney »

droope wrote:Sometimes, we execute files just by tiping, for example, "firefox" on console. When we need to make a shortcut, sometimes we need the full path.

In those cases, instead of searching manually, one can do the following:
in console
which firefox
And it will tell you.
To extend that, use back quotes. Linux, like Unix before it, will take something in back quotes, run it and return the result to the shell.

So if I want the make the location of Firefox a variable, I can say

FIREFOX=`which firefox`
echo $FIREFOX
/usr/bin/firefox

This is a handy construct in shell scripts where the value may be different on one system than another.
______
Dennis

OverDrive
Posts: 178
Joined: Mon 02 Jan 2006, 05:07
Location: Cleveland, OHIO,USA

#10 Post by OverDrive »

G0XAN, That is a *dandy* little script you got there. I was looking for a answer to that problem a few days ago myself. I had to modify the path to the state file for my laptop config and extended the test period to 10 minutes, after that it works like a champ! Here is my version in case anyone wants to see the differences for their own tweaking.

Code: Select all

#!/bin/bash
# AC Power monitoring script
# This script monitors the AC power connection every 30 seconds
# and pops up a message box if the power is disconnected

# AC Power state is available in:    /proc/acpi/ac_adapter/ADP1/state
# Power disconnected, file contains: state:<spaces>off-line
# Power connected, file contains:    state:<spaces>on-line

# define script name for use in dialog box titles
cScriptName=${0##*/}

while [ 0 ] # repeat for ever
do
   if grep -q off-line /proc/acpi/ac_adapter/AC/state #-----------Modify this line for your path to the state file....
   then
      vMessage="Mains power failure!"
      Xdialog --left --title $cScriptName --msgbox "$vMessage" 10 50
   fi
    sleep 600 # sleep for 600 seconds (10 minutes)-------Modify this line for your time interval....
done

OverDrive
Instant Puppy Fan!!!

User avatar
prehistoric
Posts: 1744
Joined: Tue 23 Oct 2007, 17:34

Obsolete knowledge: spelling

#11 Post by prehistoric »

Here's a tip I posted some time back. The original purpose was to get spell checking with Sylpheed, which had been compiled without built-in spell checking. This is useful as an example of a work around for other purposes. You don't have to use options like the external editor hook in Sylpheed for the original purpose. (Of course, you must install the aspell dictionary for the language you want to use.) For most people this will be useful only as an example of how to launch a program which runs in a terminal window.

At present, I'm on a machine fast enough to use Abiword for spell checking. You simply install the dictionaries you use under Abiword, and select the option for automatic spell checking. Then you define Abiword as your external editor. Because Abiword is part of standard Puppy this is a quick hack for getting spell checking if you replace Seamonkey mail with Sylpheed. (Seamonkey mail has its own spell checking, using a different program and dictionaries.) I haven't used the older hack in a while, because Abiword is good enough, on this machine, even if it doesn't know to ignore links in email.

On older versions of Puppy, there is a Gtkspell package that works, and has less overhead, but it hasn't been updated to work with Puppy 4 series.
prehistoric wrote:
There are versions of Sylpheed with built-in spell checking, but the ones making it into Puppy packages generally don't have it. I can't comment on Sypheed under 4.0 because I'm not running that, but I have long used it under 3.01 with a hack that gives me simple spell checking, if not the best interface. I have defined the external editor, (common preferences->details->external commands) as follows:

Code: Select all

rxvt -e aspell -e -c %s
This tells it to run aspell in a terminal with email rules and interactive correction on the file passed to the command. Most of the time the correction I want is in the first 3 alternatives it presents.

I keep thinking I'll get around to installing gtkspell and keep forgetting, because this is just good enough for the present.

User avatar
prehistoric
Posts: 1744
Joined: Tue 23 Oct 2007, 17:34

the old center click trick

#12 Post by prehistoric »

Suppose you are using an rxvt console to get debugging information by running a command that is producing error messages. How do you get those messages into a text editor?
prehistoric wrote:
dougeeebear wrote: ...Is there a way to copy/paste with that stupid console?
Is there something better with some features and tabs?
Open a text editor window, select the text you want in the console window, then center click in the editor window to copy to the editor. (You can emulate center click by clicking both right and left buttons simultaneously.)
Old Unix hands will remember using tee to send or append output to a file, while still seeing it on the console. Puppy has busybox tee. You can merge error output with standard, if cryptic, command line syntax, used here to save output from a make command used to build a program.

Code: Select all

make 2>&1 | tee build.log
There is also a utility called script on many Linux systems which records entire terminal sessions. Has anyone packaged this for Puppy?

Added: This just came up on a separate thread, after I posted here.

There may be a little confusion about that last command. Tee splits the output stream and sends one branch to the file, the standard output from tee still appears on the console, if not directed elsewhere. This way tee can be used for debugging long pipelines of commands. Just insert tees where you want to capture output.

User avatar
prehistoric
Posts: 1744
Joined: Tue 23 Oct 2007, 17:34

command line downloads, etc.

#13 Post by prehistoric »

Here's an exchange I just ran across. The original problem was putting the wrong link in the box for pwget. (A link to a directory, not a file.) This is explained further down.

In the process, we learn about a robust command for downloads. Before I found Puppy Linux, I used this method to build an entire system from source, before I got the GUI working. If the Linux system you're on doesn't have wget, it probably has serious deficiencies. In the world before flash drives, Tom's root/boot floppy got me many things this way, even on machines where very little worked.

BTW: notice that "Roy" uses 'the old center click trick' described above.
anonymous newbie wrote:How does one enter an address in pwget to download this iso ?It has the initial address shown in the first post in the thread ie http://www.puppylinux.asia/tpp/NOP which does not name the file in question. If I put this in pwget and give a download folder it shows the console with a link up process then this disappears and the download folder appears. If I add the ISO in question ie http://www.puppylinux.asia/tpp/NOP/puppy-431-boxpup.iso Then the same thing happens that is ,the console appears then disappears and the download folder appears. Am I missing something. I have downloaded ISO s before when the link has the whole address including the name of the ISO and had no problem.I put it down to premature senility but hope there is a better answer.
Roy wrote:I do not know about pwget, but if you use the following commands in Puppy's desktop Console, it will work:

Code: Select all

wget -c --user=puppy --password=linux http://www.puppylinux.asia/tpp/NOP/puppy-431-boxpup.iso
Should you need to interrupt your download for any reason, simply press Ctrl+C to pause it. Using your keyboard's Up Arrow will bring back the original command shown in the code window above; pressing Enter with your blinking cursor at the end of that command line will resume the file transfer. Using this command line with the '-c' in it will also cause the transfer to restart on its own if the connection is temporarily interupted.

-Roy
Roy Thanks for that,it worked perfectly.I dont know why the pwget setup did not work but the CLI system is perfect. Unfortunately to some of us the Console stuff has to be spelt out.I only know enough about this stuff to know what I dont know, Also people who are working in a system that they deeply understand have trouble realising that others in another area havent a clue what they are talking about.
Anyway thanks again ,I guess that this just proves that if you want to know the answer you must ask the question.
Regards D.
Roy wrote:You are right; the command line stuff is not what a typical Windows refugee needs to begin using Linux. Personally, I am extremely grateful for these guys who have gone out of their way to create GUI's for guys like us in the past year or two. I only know the wget commands because the GUI stuff was not available when I first started using Puppy.... BTW, you should notice that the wget commands download to your root directory, unless you open the Console from within another directory OR use 'cd /your/target/directory' before inputing the commands I previously provided.
anonymous newbie wrote:Roy Unfortunately the wget and pwget seem to fall down on some download sites.I just tried to use it on this site http://lhpup.org/download443.htm#Base/L ... 4.43-d.iso and it it downloaded for a couple of seconds and then declared itself finished.
Roy wrote: That site does not require a username or password, as far as I know. For wget, your command line should look like this:

Code: Select all

wget -c http://lhpup.org/beta/lhp443/LighthousePup-4.43-d.iso
Note the different web address in my command line, compared to what you were using. To find the correct address, go to the actual download webpage, Right click on the .iso file link, and select Copy Link Location from the drop down menu.

Now when you open your desktop Console, type 'wget -c', add a space with your space bar, and click by pushing down on the center (scroll wheel) of your mouse. This center-click will paste that copied file address into your console.

Hit your Enter key, sit back, and smile....

I think you were trying to download a link that pointed to a web page that contained another link to the file. When you put your mouse pointer over a file name on a web page, look down at the bottom of your Seamonkey screen. If you do not see the actual file name that you are wishing, then it isn't the actual file; it's just another webpage link.

-Roy
Added: Just tried Tom's Root/Boot Floppy on a dual-core system with 2 GB RAM, to see if it would still work. There were some glitches, but overall it did. Considering the changes in computing since this was written, I'd call that remarkable.

For anyone perverse enough to try this themselves, here are a couple remarks. This program uses a non-standard format the Puppy floppy formatter will not create to fit more data on a floppy. There is a Linux program on the download which will access the raw device, and do what is necessary. Not all floppies, or floppy drives, will work, though most I've tried will.

When you try to run this program under Puppy according to his instructions, you will get an error, because Tom assumed the current directory is at the head of your PATH. (This is a terrible security hole for people running as root, and BarryK knows better.) The way around this is to temporarily prefix it to your PATH in a sub-shell.

Code: Select all

(PATH=".:$PATH" ./install.s)
This illustrates a useful trick for setting variables used only in a particular context.
Here's a test, which also illustrates something about quoting and contexts in shell scripts:

Code: Select all

# echo echo' $PATH'>eecho
# chmod +x eecho
# (PATH=".:$PATH" eecho)
.:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/opt/samba/bin
# echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/opt/samba/bin
# (PATH=".:$PATH" eecho)
.:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/opt/samba/bin
# echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/opt/samba/bin
 

User avatar
yarddog
Posts: 188
Joined: Mon 30 Nov 2009, 23:00
Location: Great Smoky Mountains, TN USA

#14 Post by yarddog »

I am fairly new to linux and spend a lot of time trying out new versions which I was burning to CD-R's. This created quite few coasters or frizbees, therefore, I began using CD-RW's to burn the new versions.
This has worked great for me. If the version is not a keeper, I simply use pburn to blank the CD-RW and reuse. Some of these have been reused 10-15 times and so far, no problems.
Hope this helps someone.
yarddog

chrissy
Posts: 18
Joined: Sat 16 Jan 2010, 18:45

#15 Post by chrissy »

I expect this seems obvious but it took me about a week to work out :P

I install my puppy to external usb hard-drive.
Sometimes I make a complete mess of things and cant get back in after spending all day setting things up.
So now I install it all, get to the point where it is working just the way I like it,then boot from a live CD with the hard-drive turned off(so i don't confuse which drives are which),turn on the hard-drive and copy the save file to another location (partition or second hard-drive) then if I make a mess of things, I can just go copy the saved file back over the messed up one.
This is handy for the files that I download too .
I have a folder called saves where I put my downloaded files after I install them and that gets backed up on its own.
I dont think it really needs to be a harddrive, I think you could easily back up to dvdrw or cdrw instead.
Saves hours of putting everything back and means I'm not afraid to try a new application.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#16 Post by dejan555 »

I see which command mentioning
To open script that's in executable path in geany:

Code: Select all

geany `which defaultpaint`
To change default paint application from command line I use sed which is powerfull text stream editor:

Code: Select all

sed -i 's/mtpaint/gimp/' /usr/local/bin/defaultpaint
These are not some commands that only I know really, they're widely known but I find myself using them recently in puppy related file operations. :P Maybe I digg some more practical scripts.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
prehistoric
Posts: 1744
Joined: Tue 23 Oct 2007, 17:34

really simple link

#17 Post by prehistoric »

I hope that everyone using Puppy has figured out that you don't want to download ISO images, etc. into the virtual file system in RAM, when it is easy to download them to a separate directory on the device mounted as /mnt/home. (I use /mnt/home/downloads.)

Note: when you are running from CD without using a pup-save file there will not be a home partition. Reboot and save to a file, and the partition used will be mounted as /mnt/home.

When you get tired of clicking on filesystem, then /mnt, then home, then downloads, to use downloaded files, you can put a symbolic link which will take you directly to /mnt/home in your /root directory like this:

Code: Select all

ln -s /mnt/home /root/home
You can also link directly to the downloads directory (folder).

Code: Select all

ln -s /mnt/home/downloads /root/downloads
If you are running several different puplets on one machine (at different times), they can all use the same downloads directory, provided the partition it is on is mounted in each of them.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#18 Post by Lobster »

Cleaner Leaner Puppy? - yep it is possible . . . and simple :)

go to
Menu / System / Bootmanager configure bootup
(that is the right click on desktop or bottom left click)

then . . . Manage System Services
Use Help to sort out what to do

My config:
I never print (turned off CUPS Deamon)
SLmodems - no thank you
syslogger - m m m . . . may use in bug reporting (decided it could go)
Firewall - kept that even though router has one
Hardware hotplug - yep need that for USB

I am using 4.3.2 Experimental (Woof build) but this should be in Puppy 4.3.1 - maybe earlier and puplets too
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

ken geometrics
Posts: 76
Joined: Fri 23 Jan 2009, 14:59
Location: California

#19 Post by ken geometrics »

sc0ttman wrote:yes, this thread is a good idea...

I have no real tips, other than something i learned recently..

to get and use variables from files in bash or the terminal, type

Code: Select all

. /path/to/FILENAME
echo $VAR


this will show 'hello' if the file called FILENAME above contains

Code: Select all

VAR=hello
You can combine this with the fact that the "env" command lists all the current variables to make a simple way to save all the current values of your variables from one run of a script to the next. The simplest way to do this is to make all your variables have some unlikely string in their names:

env | grep _QJXV_ >saved.config

In english "_QJXV_" is very unlikely.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#20 Post by ecomoney »

Playing flash videos full screen with no stutter/crashes

Flash is a buggy, bloated PITA. There is a trick however...

Many flashplayers on movie streaming sites use the /tmp directory to "buffer" their video streams. The VLC player can play these directly. First you need the VLC player

http://www.murga-linux.com/puppy/viewtopic.php?t=31890

Simply go to the streaming website and start the stream playing, then immediately hit the pause button, and minimize your browser. Next open ROX and navigate down the directory tree using the up arrow in the top left of the window. Go into the /tmp directory and you will notice some video files with wierd alphanumeric names. Clicking on them will open them in VLC, from which you can "seek" through the video and play them in full screen.

Things should be much improved when sites start using the new html5 video standard in firefox 3.6. :)
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

Post Reply