Author Topic: linux  (Read 24688 times)

0 Members and 1 Guest are viewing this topic.

Walks_At_Night

  • Hall Of Famer, Morg!
  • Ellevated
  • *****
  • Posts: 16086
  • Morg!
Re: linux
« Reply #30 on: July 14, 2018, 06:14:10 PM »
nano is a easier to use command line text editor, as opposed to vi/vim/joe/ed

I went from ed to vi to vim and never made it any further.   I'll have to check out nano................

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #31 on: July 14, 2018, 06:47:25 PM »
command line shortcuts
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + u – make uppercase from cursor to end of word
Alt + l – make lowercase from cursor to end of word
Alt + t – swap current word with previous
Ctrl + f – move forward one character
Ctrl + b – move backward one character
Ctrl + d – delete character under the cursor
Ctrl + h – delete character before the cursor
Ctrl + t – swap character under cursor with the previous one
Ctrl + r – search the history backwards
Ctrl + l – clear the screen
Ctrl + s – stops the output to the screen (for long running verbose command)
Ctrl + q – allow output to the screen (if previously stopped using command above)
Ctrl + c – terminate the command
Ctrl + z – suspend/stop the command
!! – run last command

stolen from https://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/ because im to lazy right noaw to type all that in.
example of the !!
lets say you want to run ipconfig to see your ip address. so you type :
ipconfig
and get
command not found (because you need root permissions to run that command)
so you would type :
sudo !!
and it asks for a password and (hopefully) outputs the ip address and not an error of some kind (You are not in the sudoers file ...) .
that twas a simple example , much more useful if  you had a command like :
while read line;do a=$(cat "$line" | sed 's/^ \/t//;s/ /,/g"); lynx -dump "www.google.com/$a" > x=$(($x+1))-google.txt;done <some.file
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #32 on: July 14, 2018, 07:04:38 PM »
for my next trick : convert pdf's to .tiff then use a ocr to pull text out of the .tiff.
so you have a pdf.  the document is image files and not text so you cant simply copy/paste the text out of it, but you need the text out of it. here is the answer:
you need to install tesseract , in most linux distros software centers, for this to work.
make a directory:
mkdir pdf2text

copy the pdf over to that directory and move into that directory
cp file.pdf pdf2text; cd pdf2text

next you run the convert command:
convert file.pdf pages-%03d.tif

what this does is pull each page from the pdf and converts the page to a .tif file with a unique filename

next you will make a simple loop to convert the .tif files to text files
for i in $(ls *.tif);do a=$(echo $i | awk -F "." '{print $1}');tesseract "$i" "$a";done


this will loop 1 time through each .tif file and create a text file with the same name as the tif file . and there's the text from your pdf
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

Dyna-X

  • Ellightened
  • ******
  • Posts: 3392
Re: linux
« Reply #33 on: July 14, 2018, 07:14:06 PM »
command line shortcuts
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + u – make uppercase from cursor to end of word
Alt + l – make lowercase from cursor to end of word
Alt + t – swap current word with previous
Ctrl + f – move forward one character
Ctrl + b – move backward one character
Ctrl + d – delete character under the cursor
Ctrl + h – delete character before the cursor
Ctrl + t – swap character under cursor with the previous one
Ctrl + r – search the history backwards
Ctrl + l – clear the screen
Ctrl + s – stops the output to the screen (for long running verbose command)
Ctrl + q – allow output to the screen (if previously stopped using command above)
Ctrl + c – terminate the command
Ctrl + z – suspend/stop the command
!! – run last command

stolen from https://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/ because im to lazy right noaw to type all that in.
example of the !!
lets say you want to run ipconfig to see your ip address. so you type :
ipconfig
and get
command not found (because you need root permissions to run that command)
so you would type :
sudo !!
and it asks for a password and (hopefully) outputs the ip address and not an error of some kind (You are not in the sudoers file ...) .
that twas a simple example , much more useful if  you had a command like :
while read line;do a=$(cat "$line" | sed 's/^ \/t//;s/ /,/g"); lynx -dump "www.google.com/$a" > x=$(($x+1))-google.txt;done <some.file

I'm guessing this is only for the command line interface. Will My usual CTRL-C, CTRL-V, CTRL-S, CTRL-F, F5 (refresh), arrow keys, etc still work outside this environment? I still use these daily.




wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #34 on: July 14, 2018, 07:23:13 PM »
I'm guessing this is only for the command line interface. Will My usual CTRL-C, CTRL-V, CTRL-S, CTRL-F, F5 (refresh), arrow keys, etc still work outside this environment? I still use these daily.
yes its only for the terminal environment. the keys you mentioned will work in any gui environment for every program except a terminal.
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

Lob Bazare

  • KDWN
  • ***
  • Posts: 122
Re: linux
« Reply #35 on: July 17, 2018, 12:14:41 PM »
heres a placeholder for linux.

Right on! Glad to see a Linux section. Thanks wr250, I'm sure I can learn something from here.
I'm new to Linux. Tried most of the Ubuntu flavors of Bionic Beaver. XUbuntu worked best on my slow laptop. Kind of liked Budgie the best, but it was a bit slower than X. Been on a PC since the Vic-20 and I got tired of fighting with Windows. Loving Linux and there is no going back. I have actually been using Termux on an old Android tablet so I had a wee bit of experience before trying Linux. I'm using Tasker to trigger a script in Termux to run FFMPEG and record a few streaming shows. They then get uploaded to my cloud and downloaded automatically on my phone every morning. Works great when I'm travelling. The old tablet uses less power than keeping a PC on all the time and lasts longer in the event of a power outage. My favorite script is:

mitddate=$(date +"%a %b %d")

curl -H "Content-Type: application/json" -X POST -d '{"value1":"Recording Midnight in the Desert"}' https://maker.ifttt.com/trigger/{"id10t"}/with/key/XXXXXXXXXX

ffmpeg -i http://live2.darkmatterdigitalnetwork.com:10133/stream -metadata title="MITD $mitddate" -metadata album="Midnight in the Desert" -metadata artist="Darkness Dave" -f mp3 -acodec libmp3lame -ab 64k -ar 22050 -t 10800 "MITD $mitddate.mp3"

zeebo

  • KDWN
  • ***
  • Posts: 139
Re: linux
« Reply #36 on: July 17, 2018, 01:44:55 PM »
Here's one for you.  My old Win 7 machine was failing, and also HP's final BIOS release didn't support newer video cards.  So I figured I'd upgrade and try a Dell this time, an XPS model.  I didn't do much research, just got one that had good specs.  Well after about a month of trying to adjust to Win 10, which is not as disastrous as Win 8, but still overall a bloated, clunky, intrusive suckage fest compared to 7, I decided I'd try to downgrade.

Guess what, this machine has no friggin Win 7 drivers.  And guess what else, from what I've read online, it's practically impossible to run Linux on this thing.  Can you imagine, a modern computer that can't run a generic linux distro?  The hardware seems basically designed to force you into Win 10.  Must be a coincidence though as I know Microsoft never would encourage such things.

JUAN

  • Ellevated
  • ******
  • Posts: 8467
Re: linux
« Reply #37 on: July 17, 2018, 02:05:10 PM »
I went from ed to vi to vim and never made it any further.   I'll have to check out nano................
emacs forever
Merry Christmas

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #38 on: July 17, 2018, 04:35:16 PM »
emacs forever
well that was coming ...
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #39 on: July 17, 2018, 04:44:39 PM »
Right on! Glad to see a Linux section. Thanks wr250, I'm sure I can learn something from here.
I'm new to Linux. Tried most of the Ubuntu flavors of Bionic Beaver. XUbuntu worked best on my slow laptop. Kind of liked Budgie the best, but it was a bit slower than X. Been on a PC since the Vic-20 and I got tired of fighting with Windows. Loving Linux and there is no going back. I have actually been using Termux on an old Android tablet so I had a wee bit of experience before trying Linux. I'm using Tasker to trigger a script in Termux to run FFMPEG and record a few streaming shows. They then get uploaded to my cloud and downloaded automatically on my phone every morning. Works great when I'm travelling. The old tablet uses less power than keeping a PC on all the time and lasts longer in the event of a power outage. My favorite script is:

mitddate=$(date +"%a %b %d")

curl -H "Content-Type: application/json" -X POST -d '{"value1":"Recording Midnight in the Desert"}' https://maker.ifttt.com/trigger/{"id10t"}/with/key/XXXXXXXXXX

ffmpeg -i http://live2.darkmatterdigitalnetwork.com:10133/stream -metadata title="MITD $mitddate" -metadata album="Midnight in the Desert" -metadata artist="Darkness Dave" -f mp3 -acodec libmp3lame -ab 64k -ar 22050 -t 10800 "MITD $mitddate.mp3"
i have in the past used something like
Code: [Select]
cvlc -v source :sout='#transcode{vcodec=none,acodec=mp2a,ab=128,channels=2,samplerate=48000}:std{access=file,mux=mp3,dst="file-$(date +"%d-%m-%y".mp3"}' vlc://quit
to record stuff
you can also add --starttime and --stop to the parameters for more control.
actually the script was far more complex and designed to record one thing that had many episodes.
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #40 on: July 17, 2018, 05:02:51 PM »
Here's one for you.  My old Win 7 machine was failing, and also HP's final BIOS release didn't support newer video cards.  So I figured I'd upgrade and try a Dell this time, an XPS model.  I didn't do much research, just got one that had good specs.  Well after about a month of trying to adjust to Win 10, which is not as disastrous as Win 8, but still overall a bloated, clunky, intrusive suckage fest compared to 7, I decided I'd try to downgrade.

Guess what, this machine has no friggin Win 7 drivers.  And guess what else, from what I've read online, it's practically impossible to run Linux on this thing.  Can you imagine, a modern computer that can't run a generic linux distro?  The hardware seems basically designed to force you into Win 10.  Must be a coincidence though as I know Microsoft never would encourage such things.

you could try the current version of linux mint or ubuntu, i like mint better personally. both have signed certs to deal with the secure boot issue (you could turn off secure boot in the bios if you like).
and yes it would look like $micro$oft has forced everyone into their os, but will give out the needed certs when asked (and verified to be non malicious).


onto "secure boot" . it sucks.
reasons why it sucks:
1. tries to prevent the install of non windows os'es (unless they buy a cert from ms)
2. isnt at all secure


addressing #2 :
with various intel ME (intel management engine, designed for sysadmins to remotely administer a computer to the bios level, so they dont need to drive 50 miles to change the boot drive for example) has a number of exploits which can gain an attacker full access to a computer and there is no antivirus that can detect it. its a os that runs on the processor, and is always running as long as there is power. all intel processors since 2008 have this "feature", and it cant be disabled or the chip will not boot. 
therefore with ME able to change all bios settings , secure boot isnt secure at all. 
statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #41 on: July 18, 2018, 06:58:33 AM »
function for random passwords:
Code: [Select]
ranpass () {
tr -dc '[:print:]' < /dev/urandom | fold -w10 |head -n1 |sed 's/ /g/'
}


add this to the bottom of your .bashrc (/home/username/.bashrc). logout then log back in or type
Code: [Select]
source .bashrc

this will print a 10 digit random char string suitable for use as a password. EX:
user@localhost:~$ ranpass 
[%%|IeSXxi
 


statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/

zeebo

  • KDWN
  • ***
  • Posts: 139
Re: linux
« Reply #42 on: July 18, 2018, 11:53:11 AM »
you could try the current version of linux mint or ubuntu, i like mint better personally. both have signed certs to deal with the secure boot issue (you could turn off secure boot in the bios if you like).
and yes it would look like $micro$oft has forced everyone into their os, but will give out the needed certs when asked (and verified to be non malicious).


onto "secure boot" . it sucks. ....

Neat thanks for the info!  I will definitely check those out.  :)  I thought it was hopeless but I'll do some experimenting, maybe with a bootable disc or such.

One thing linux has had for so long is Virtual Desktops which are so awesome, essential even, for managing tons of open apps.  Well on Win 7, I found a little util on sourceforge that did a pretty good job mimicking the linux style.  Then guess what.  Stupid Win 10 comes along, breaks it (along with several other alternatives), and adds their own stupid version called Task View which sucks, and then with a recent release just arbitrarily broke it worse (part of the wonderful Windows-as-a-Service model). 

I may actually switch to linux just for that one feature, which linux has had for like twenty years, and a single random developer added to Win 7, but a whole MS team couldn't do right for Win 10.  Also, as an aside, linux has the best screensavers - stupid Windows doesn't even have starfield anymore.  >:(

Walks_At_Night

  • Hall Of Famer, Morg!
  • Ellevated
  • *****
  • Posts: 16086
  • Morg!
Re: linux
« Reply #43 on: July 18, 2018, 05:44:26 PM »
@zeebo As wr250 mentioned try out Linux Mint - I like the cinnamon
desktop but hell anything is better than unity/ubuntu.  If it won't install, again as wr250 mentioned you can try and disable
secure boot in the systems bios.   It is quite possible that Dell nerfed that capability - you'll just have to look and see.

If you get stuck there is another option - you can try installing Virtual Box and running Mint as a
virtual machine under Windows 10.   Once you install the virtual box guest tools, just go into full screen mode and rock and roll.  That is what I do at work - they put a bunch of big brother software on Windows 10 so I just roll with Mint in a VM. 


wr250

  • Elluminati
  • ******
  • Posts: 1352
  • tux the magic penguin
Re: linux
« Reply #44 on: July 20, 2018, 06:06:45 AM »
another function for the .bashrc file:
Code: [Select]
findip() {
nmap -sP 192.168.0.0/24
}
requires nmap to be installed.
this finds all ips on your local network.
adjust the ip to suit your local network. scanning other networks is not advised and may be illegal where you reside.
usage : add to /home/username/.bashrc 
they type findip
it will take a few seconds then list all the ips it has found.
example:
Nmap scan report for <computer name>  (192.168.1.1)
Host is up (0.00033s latency).
Nmap scan report for 192.168.1.2
Host is up (0.00013s latency).
Nmap scan report for 192.168.1.50
Host is up (0.0087s latency).



statistics can be used to prove anything. 14% of the people know this.
https://lptd.home.blog/