Search found 443 matches

by FreedomTruth
Sat Sep 03, 2022 9:21 pm
Forum: Scripts & Bash
Topic: Searching the last 5 field of each line in a csv, a puzzling output.
Replies: 2
Views: 839

Re: Searching the last 5 field of each line in a csv, a puzzling output.

csvcut https://github.com/zigazou/csvcut may be useful. It's like the "cut" command for csv input. Some other tools that may be of interest, possibly installable by apt / synaptic: csvkit and csvtool Note, I've not used any of these, and am not vouching for them, but it seems like they co...
by FreedomTruth
Fri Aug 05, 2022 11:42 pm
Forum: Scripts & Bash
Topic: Wordle Solver
Replies: 20
Views: 1673

Re: Wordle Solver

Not a "solver" but (a variation on) the game itself, to be run in terminal window. It's not perfect but I've stopped working on it, it's good enough for me to play on my own system occasionally :-) #!/bin/bash if [ ! -z "$1" ]; then # make sure $1 is an integer ... ntest=$(expr $...
by FreedomTruth
Fri Aug 05, 2022 11:05 pm
Forum: Scripts & Bash
Topic: need batch command mp4 to mp3 (remove video)
Replies: 8
Views: 1190

Re: need batch command mp4 to mp3 (remove video)

ffmpeg -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3 it works great, but only processes one file at a time. I would like a command, file, or script that is capable of removing the video on all .mp4 files in a directory and leaving only .mp3 files. can this command be used f...
by FreedomTruth
Fri Apr 08, 2022 5:10 pm
Forum: Scripts & Bash
Topic: bash script that randomly prints numbers between 1 and 10 without repetition
Replies: 13
Views: 1161

Re: bash script that randomly prints numbers between 1 and 10 without repetition

This entire exercise is much simpler if you pre-randomize the results:

Code: Select all

#!/bin/bash
echo "3 5 2 1 4 8 9 7 6 10"
:-)
by FreedomTruth
Thu Jul 29, 2021 11:04 am
Forum: Scripts & Bash
Topic: bash script memory size in gb
Replies: 28
Views: 3639

Re: bash script memory size in gb

Kadaitcha Man wrote: Thu Jul 22, 2021 3:12 am
Zgrywus wrote: Thu Jul 22, 2021 3:05 am Is there a way to do script which shows (free -g + 1)? :P
Yes.

Code: Select all

echo 4
Haha :lol: That looks similar to some "random number generator" code I once saw. :D
by FreedomTruth
Tue Jul 13, 2021 10:50 pm
Forum: Scripts & Bash
Topic: wget with recursive, overwrite & erobots off
Replies: 7
Views: 1210

Re: wget with recursive, overwrite & erobots off

The "problem" is that -O is not overwrite. It specifies the output file name.
Since your source is apparently a directory, try putting a / at the end of it. Then -r seems to not complain about it being a directory. In your particular case:

Code: Select all

wget -r -erobots=off http://192.168.0.2/stats/
by FreedomTruth
Mon Jul 12, 2021 10:37 am
Forum: Scripts & Bash
Topic: wget with recursive, overwrite & erobots off
Replies: 7
Views: 1210

Re: wget with recursive, overwrite & erobots off

Sorry if this is a redundent question. I've googled many phrases trying to find out how to do the following: use wget to download a series of pages off my local server. I know the following options: - r = recursive download of the webpages behind the index.html file - O = overwrite the previous fil...
by FreedomTruth
Sat Jul 10, 2021 11:10 pm
Forum: Scripts & Bash
Topic: Grep or Cat Cut Value Used in Subsequent Grep of Cat "criteria" Statement
Replies: 4
Views: 1348

Re: Grep or Cat Cut Value Used in Subsequent Grep of Cat "criteria" Statement

Jator wrote: Sat Jul 03, 2021 8:45 am

Code: Select all

cat /pathtofile/name.txt | head -2 | tail  -1 | cat/pathtofile/records.txt | grep "?"
grep $(readline 2 name.txt) records.txt

or, if you really like head and tail,
grep $(cat name.txt | head -2 | tail -1) records.txt
by FreedomTruth
Tue Feb 23, 2021 2:37 pm
Forum: Scripts & Bash
Topic: Possible Exploit with Copy/Paste to Terminal?
Replies: 17
Views: 2569

Re: Possible Exploit with Copy/Paste to Terminal?

if this was an exploit and it the command had sudo, you would still have to enter your password Yes. I realize I'm posting a month late to the discussion, but this may still be helpful to point out. One thing about "sudo" use is that once you successfully use sudo in a terminal, you do no...
by FreedomTruth
Fri Dec 04, 2020 11:43 pm
Forum: Scripts & Bash
Topic: [SOLVED] Bash script to advise when Internet restored
Replies: 9
Views: 1407

Re: Bash script to advise when Internet restored

Busker wrote: Fri Dec 04, 2020 7:33 pm

Code: Select all

-rwxrwxr-x  1 tux tux       1033 Nov 12 14:03 tint.sh
If you suspect line-ending problems, check your file size. I copied your code at the end and have a 1023-byte file, which does execute correctly (other than paplay which I do not have).
by FreedomTruth
Fri May 08, 2020 1:23 am
Forum: Scripts & Bash
Topic: Need help to create login script to modify /etc/hosts
Replies: 12
Views: 1891

Re: Need help to create login script to modify /etc/hosts

I know I'm a little late to reply. If you've not already found a solution, here's another suggestion which may or may not help your particular case. You could put a few entries in /etc/crontab to run, say, (a) M-F at 8am (or whenever) to copy your restricted hosts file, then (b) at 4pm to copy your ...
by FreedomTruth
Fri Jan 24, 2020 11:59 pm
Forum: Scripts & Bash
Topic: cannot cp file to directory with spaces in name
Replies: 8
Views: 2210

Re: cannot cp file to directory with spaces in name

I know it's already been asked and answered. The two problems were: 1) You were escaping the quotation marks. "/home/bobi/tmp/\"dir with spaces\"" is not the same as /home/bobi/tmp/"dir with spaces" The first has the quotation marks in the directory name, which is not w...
by FreedomTruth
Sat Mar 02, 2019 1:06 pm
Forum: Scripts & Bash
Topic: Script users
Replies: 13
Views: 2019

Re: Script users

The purpose of the script is to request a username, if it does not exist, and then create it. But if it already exists ask for another name. #! / bin / bash echo -n "Do you want to enter a user? (s / N):"; read answer yes [$ answer = 's']; so echo "Enter the user:" read USER if ...
by FreedomTruth
Sat Mar 02, 2019 12:25 pm
Forum: Beginner Questions
Topic: How to force an application to start on secondary display
Replies: 3
Views: 2224

Re: How to force an application to start on secondary display

NOTE I'm not running Mint 19.1 Cinnamon. I do use a dual-monitor setup. My desktop is XFCE. I have noticed that the behavior seems largely program-dependent. In general, most programs seem to open their window on whatever monitor the mouse is currently positioned. So I usually position the mouse to ...
by FreedomTruth
Fri Feb 22, 2019 10:48 pm
Forum: Scripts & Bash
Topic: shutdown via cron? [solved]
Replies: 9
Views: 2185

Re: shutdown via cron?

murray wrote: Thu Feb 21, 2019 10:55 pmOr is there a better way to do what I'm trying to do?
"Better" is always subjective. I'm curious why you don't just have your webserver run the dump, zip, and email in a cron job? It just seems like this is a complicated way of doing it. :)
by FreedomTruth
Tue Feb 12, 2019 10:32 am
Forum: Other topics
Topic: Do I really need to encrypt home if I have full disk encryption?
Replies: 19
Views: 3362

Re: Do I really need to encrypt home if I have full disk encryption?

2) Are there any benefits to having the `home` encrypted with encfs if full-disk LUKS encryption is also enabled? Not in a single user scenario. In a multi-user scenario it gives protection from other users (including administrators) accessing your files. Ideally, yes. However in testing (on LM18) ...
by FreedomTruth
Tue Jan 29, 2019 11:24 pm
Forum: Beginner Questions
Topic: New Linux user from windows 10
Replies: 21
Views: 2860

Re: New Linux user from windows 10

So as a new user who isn’t very technical, what would you recommend. For a new user, I recommend mint, mainly because of the forums :-) You can almost always find some kind of help/support, answers to questions... Biased? Maybe. But I don't use mint as my main o/s anymore (I do still run it in a vm...
by FreedomTruth
Sun Jan 27, 2019 2:32 pm
Forum: Scripts & Bash
Topic: New to automation/scripting, Switch to python?
Replies: 2
Views: 1061

Re: New to automation/scripting, Switch to python?

Just a suggestion to make it a little more readable, I prefer using echo -e "blahblah\n\n" -- the \n will insert a newline for you. In fact you could even combine the command you're running along with the echo command. Such as: echo -e "Sockets:\n\n\n$(sudo systemctl -l|grep .socket)\...
by FreedomTruth
Sat Jan 26, 2019 10:34 am
Forum: Beginner Questions
Topic: Unexpected behaviour of Rsync
Replies: 45
Views: 2688

Re: Unexpected behaviour of Rsync

Both DIR and LS commands report the file as being without the trailing period. tony@tony-Latitude-E6430 /media/tony/DropBox_A/Dropbox/New_Pics_vids/catalogueds/2012-06-03 $ ls 143*.*|hexdump -C 00000000 31 34 33 2e 4a 50 47 0a |143.JPG.| 00000008 tony@tony-Latitude-E6430 /media/tony/DropBox_A/Dropb...
by FreedomTruth
Fri Jan 25, 2019 10:01 am
Forum: Beginner Questions
Topic: Motherboard code 90 error after adding second drive
Replies: 4
Views: 297

Re: Motherboard code 90 error after adding second drive

By comment out I assume you mean remove/delete the swap entry line from the text? To "comment out" means to change the line into a comment. In this case, put a # symbol at the beginning of the line: # /swapfile none swap sw 0 0 This will disable the line from being run, and still leave it...

Go to advanced search