LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-09-2021, 12:38 PM   #181
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452

Quote:
Originally Posted by dugan View Post
I just learned that ZSH comes with a directory changer called "cdr", which keeps a persistent history of your visited directories and lets you change to directories in that history. It's in the "zshcontrib" manpage, which gives you three lines to set it up.

Now I'm wondering how any of the people who wrote similar projects (fasd, autojump, z, and all their clones and reimplementations) didn't know about this.
I think bash can do this too if you use pushd rather than cd. You get a stack of directories and you can go back up them using popd.
 
1 members found this post helpful.
Old 10-09-2021, 12:51 PM   #182
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by newbiesforever View Post
a progress bar, if not a very helpful one
Perhaps, it would be more helpful if pv knew the size of data to be transferred. Something like
Code:
sudo dd if=/dev/sda4 | pv -s $(lsblk -bnosize /dev/sda4) | sudo dd of=/dev/sdb2
 
2 members found this post helpful.
Old 10-11-2021, 05:17 AM   #183
hatersgottahate
LQ Newbie
 
Registered: Oct 2021
Location: The UK
Distribution: arch btw
Posts: 26
Blog Entries: 8

Rep: Reputation: Disabled
Quote:
Originally Posted by jeremy View Post
Based on this thread, here's a sticky for you to highlight something you've learned about Linux in the last 7 days. This is a great way to learn from follow LQ members and share what you've recently learned.

Hat tip to @KGIII for starting the original thread.

--jeremy
my computer COULD boot Debian, it was just not configured right.
 
Old 10-11-2021, 02:58 PM   #184
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by hazel View Post
I think bash can do this too if you use pushd rather than cd. You get a stack of directories and you can go back up them using popd.
You can also go back to the last directory you were in with 'cd -' which is handy if you need to flip/flop between two locations repeatedly.

This is something I only discovered recently, despite having used 'cd' for well over 25 years.
 
2 members found this post helpful.
Old 10-13-2021, 10:24 AM   #185
ychaouche
Member
 
Registered: Mar 2017
Distribution: Mint, Debian, Q4OS, Mageia, KDE Neon
Posts: 368
Blog Entries: 1

Rep: Reputation: 48
That you can kill all the processes using a certain file/directory/mountpoint
with fuser -k <file/directory> -m<mountpoint>

Also, fuser -v will print those processes for you (pid + name)

Code:
root@messagerie-prep[10.10.10.20] ~ # fuser -mv /var
                     USER        PID ACCESS COMMAND
/var:                root     kernel mount /var
                     root        718 ..c.. cron
                     daemon      719 ..c.. atd
                     clamav      723 F.c.. freshclam
                     root        745 F.... dovecot
                     root        794 F.... rsyslogd
                     root        863 F.... log
                     root        891 F.... apache2
                     postfix    1178 F.... opendkim
                     mysql      1251 F.c.. mysqld
                     root       1293 F.... fail2ban-server
                     www-data   1312 F.... apache2
                     www-data   1313 F.... apache2
                     www-data   1314 F.... apache2
                     www-data   1315 F.... apache2
                     www-data   1316 F.... apache2
                     root       1584 F.c.. master
                     postfix    1585 .rc.. pickup
                     postfix    1586 ..c.. qmgr
                     amavis     1588 F...m /usr/sbin/amavi
                     postfix    1603 Frc.. tlsmgr
                     amavis     1604 F.c.m /usr/sbin/amavi
                     amavis     1605 F...m /usr/sbin/amavi
                     www-data   1696 F.... apache2
                     dovecot    2176 F.... auth
                     postfix    2181 Frc.m smtpd
                     postfix    2182 ..c.. proxymap
root@messagerie-prep[10.10.10.20] ~ #
This is helpful when, for example, you need to unmount a volume but there's
something still using it.

My use case is I wanted to resize my /var/ partition. In order to do that I
need to unmount it first, but too many processes were reading and writing
to /var/. umount /var/ prints a helpful message about using either lsof or
fuser to find out about those processes. Reading the manpage of fuser
revealed the -k and -v options which are very heplful.

I decided I'd drop to runlevel 1 to stop all the processes at once, unmount
the partition, and resize it, but even after dropping to runlevel 1 there
was still the same error message from umount (resource busy), fuser showed
that mysqld was still active at runlevel 1 [is this normal btw ?].

Last edited by ychaouche; 10-13-2021 at 10:26 AM.
 
Old 10-13-2021, 11:41 AM   #186
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Yeah, I would ask how to kill root trying to unmount still in use volumes. God's intervention required I guess.

Rather poor joke. Just your situation is very unique. Myself for purpose like to resize partition I always use live system. So there there is no risk any process is actually using hard drive. Even swap on hard drive is disabled. My trust in Linux is great but not endless.
 
Old 10-13-2021, 11:49 AM   #187
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by GazL View Post
You can also go back to the last directory you were in with 'cd -' which is handy if you need to flip/flop between two locations repeatedly.

This is something I only discovered recently, despite having used 'cd' for well over 25 years.
Learned this recently, as well.

In the same vane with cd, is setting up parent aliases. For instance, whereas you normally would type 'cd ..' to traverse to parent, you can create an alias called '..'. As well, you can set up an alias for 'cd ../..' as '...' to traverse 2 parent directories, or '....' to traverse 3 parent directories. So on, and so forth. Could be useful to someone who's truly interested in minimizing bash keystrokes.
 
Old 10-13-2021, 12:11 PM   #188
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by newbiesforever View Post
When I learn something new in Linux, I keep it to myself, because I assume most LQ members already know it perfectly well.
I see you've been a member here almost as long as I have. And I think we could probably agree that the climate on LQ has changed rather drastically since the early days. I see a much more positive response to newbie posts. I guess elitism has fallen out of vogue, which is fine with me.

As long as I've tinkered with Linux, there are still simple new things I pick up here and there that would probably be considered widely known. Heck, it wasn't until just this year I finally got an amateur grasp on sed and awk. It's rare that I need these as a desktop Linux user, and it took someone explaining them layman for me to get it.

Threads like this one are a pretty good way to propagate your (new) knowledge. If you didn't know it, that means someone else didn't either. I'm slowly reading through it to see if there's something new for me to gleam.
 
Old 10-13-2021, 12:25 PM   #189
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
I also learned about dmidecode, which provides much more detailed hardware information than the ls*** commands. I use it to derive system information for display in conky. Since dmidecode requires sudo, I had to learn more about the sudoers configuration file, add it with nopasswd so that it works with conky.
 
Old 10-14-2021, 07:48 AM   #190
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,375

Rep: Reputation: Disabled
Quote:
Originally Posted by SlowCoder View Post
I see you've been a member here almost as long as I have. And I think we could probably agree that the climate on LQ has changed rather drastically since the early days. I see a much more positive response to newbie posts. I guess elitism has fallen out of vogue, which is fine with me.

As long as I've tinkered with Linux, there are still simple new things I pick up here and there that would probably be considered widely known. Heck, it wasn't until just this year I finally got an amateur grasp on sed and awk. It's rare that I need these as a desktop Linux user, and it took someone explaining them layman for me to get it.

Threads like this one are a pretty good way to propagate your (new) knowledge. If you didn't know it, that means someone else didn't either. I'm slowly reading through it to see if there's something new for me to gleam.
I must acknowledge that, without taking the time to broadly look at recent posts and compare them to old posts, I sense you're right. I have long since noted to myself that I haven't seen the individual who said "ooo this noob bites back" in years. Members like him/her are why my username is "newbiesforever" is the first place.

What I note now is that no one, you or anyone else, has so far commented to tell me I'm wrong to keep my "knowledge" to myself on the reasonable assumption that most people already know it. (That was another learned reaction to this alleged elitism.)

I also like this thread in principle. The only thing "wrong" with it is the inherent and unsolvable limitation of threads that continue for months: too long. Of course I haven't read it all, and to do so, I would have to budget time. Perhaps some weekend.

Last edited by newbiesforever; 10-14-2021 at 07:54 AM.
 
1 members found this post helpful.
Old 10-14-2021, 09:28 AM   #191
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by newbiesforever View Post
What I note now is that no one, you or anyone else, has so far commented to tell me I'm wrong to keep my "knowledge" to myself on the reasonable assumption that most people already know it.
Whether or not you contribute is your personal choice. I'm not about to wade in on that choice one way or the other. All I'll say is you'd be surprised at how much I don't know: we all have our areas of expertise, and our weak-spots.
 
Old 10-15-2021, 12:02 AM   #192
clsgis
Member
 
Registered: Nov 2007
Posts: 37
Blog Entries: 4

Rep: Reputation: 5
Lightbulb integrated TCP Wrappers

Yesterday I learned /etc/hosts.allow and /etc/hosts.deny are (optionally) respected by sshd and other daemons.

When I first started learning Linux+GNU, tcpwrappers was a separate executable, like inetd. Secure, but inefficient compared with self contained daemons.
Yesterday I decided to firewall some bots that were trying to brute force my sshd, and found a bunch of howtos recommending /etc/hosts.deny /etc/hosts.allow, the config files for tcpwrappers. But they didn't mention tcpwrappers. So I dug into manpages I hadn't looked at for a long time.

ldd /usr/sbin/sshd shows the sshd in Debian was compiled with libwrap.
 
Old 10-15-2021, 01:47 AM   #193
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by clsgis View Post
Yesterday I decided to firewall some bots that were trying to brute force my sshd, and found a bunch of howtos recommending /etc/hosts.deny /etc/hosts.allow, the config files for tcpwrappers. But they didn't mention tcpwrappers. So I dug into manpages I hadn't looked at for a long time.
Those, like the FTP-oriented tutorials, just seem to have the longest tails and just won't disappear no matter how outdated they become. Everything that tcpwrappers could do can be done more efficiently with nftables (formerly iptables) and / or sshd_config itself since more than a decade ago. I see the man page for hosts_access(5) even in the latest Ubuntu (Impish) and Devuan testing (Daedalus) and that those /etc/hosts.[allow|deny] files are still obeyed by sshd in both distros. So, today I learned that tcpwrappers may still be around. :P

The other day, I learned that cat can be used in place of dd in many situations. One example is when writing a Live image to a USB stick. Like with most things, I hope I can recall it the next time I need to do that. However both are dangerous when used that way, one can easily type the wrong destination in either.
 
1 members found this post helpful.
Old 10-17-2021, 05:10 AM   #194
ychaouche
Member
 
Registered: Mar 2017
Distribution: Mint, Debian, Q4OS, Mageia, KDE Neon
Posts: 368
Blog Entries: 1

Rep: Reputation: 48
Quote:
Originally Posted by Turbocapitalist View Post
The other day, I learned that cat can be used in place of dd in many situations.
I used cat to join two short music mp3 files into a longer one ¯\_(ツ)_/¯
 
Old 10-17-2021, 06:31 AM   #195
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Quote:
Originally Posted by ychaouche View Post
I used cat to join two short music mp3 files into a longer one ¯\_(ツ)_/¯
Try tac.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alright, it's Wednesday. What is something you have learned *new* about Linux within the past 7 days? KGIII General 120 06-15-2021 05:19 AM
What is something new that you have learned about Linux this week? KGIII General 19 05-26-2021 01:51 PM
How do I grep my /var/log/secure file for the past 7 days or so many days? johnmccarthy Linux - Newbie 5 01-04-2013 09:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration