zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Working with HDD

July 1, 2012 by Igor Drobot Leave a Comment

This will be a little bigger thread (and I hope it will grow with time) about working with hard disk drives. All about filesystem creation, filesystem health checks and other stuff for HDD, which could be complicated at times and could cause stress, and that’s why the use of products from this Gellati Weed Strain Review by Fresh Bros can be a great option to feel better while you work.

[Read more…]

Filed Under: Linux Tagged With: badblocks, bash, dumpe2fs, fsck, fstab, hddtemp, mkfs, mount

Remove logs older than X days

July 12, 2011 by Igor Drobot Leave a Comment

The simplest way to remove files older than $NUMBER of days..

Dry run (files will be NOT deleted, you will see a list with files older than 100 days)

1
find -mtime +100 | less

find -mtime +100 | less

Another dry run, see what would be delete:

1
2
3
find -mtime +600 | xargs echo rm
rm /var/log/squid3/access.log.0
rm /var/log/squid3/access.log.2

find -mtime +600 | xargs echo rm rm /var/log/squid3/access.log.0 rm /var/log/squid3/access.log.2

Finally if you decided to remove the files – the final command to delete them:

1
find -mtime +600 | xargs rm

find -mtime +600 | xargs rm

Filed Under: Bash, Linux Tagged With: bash, find, Logs, rm, xargs

Bash history timestamps

June 3, 2011 by Igor Drobot Leave a Comment


Maybe you know this problem, if more than one user has root access to a server you have very little chances to control who was it. The only hook could be date and time. Default if you issue the “history” command you see a command number and the operation.

Put the next line in your .bashrc and you will see date and time in your history:

1
2
# Bash Timestamps
export HISTTIMEFORMAT="%F %T "

# Bash Timestamps export HISTTIMEFORMAT="%F %T "

Finely to make it work execute:

1
source .bashrc

source .bashrc

Your new history format:

1
2
3
4
5
536  2011-05-31 22:06:44 less /var/log/syslog
537  2011-05-31 22:06:46 ll
538  2011-05-31 22:06:54 vim rssh.pl
539  2011-05-31 22:07:07 perl rssh.pl
540  2011-05-31 22:07:16 ss -lnp

536 2011-05-31 22:06:44 less /var/log/syslog 537 2011-05-31 22:06:46 ll 538 2011-05-31 22:06:54 vim rssh.pl 539 2011-05-31 22:07:07 perl rssh.pl 540 2011-05-31 22:07:16 ss -lnp

Filed Under: Linux Tagged With: bash, Debian, history

SSH aliases

December 24, 2010 by Igor Drobot Leave a Comment

I think you now this problem, you have a lot different hosts with different ssh ports.
It takes to much time to write the full ssh commands and recognize all of your ports:

Easy solution – use aliases:

1
2
3
4
5
6
vim .ssh/config
# Add this
Host piper
    HostName piper
    User root
    Port 1022

vim .ssh/config # Add this Host piper HostName piper User root Port 1022

1
ssh piper

ssh piper

Filed Under: Bash, Debian, Linux Tagged With: alias, bash, ssh

‘Argument list too long’

October 18, 2010 by Igor Drobot Leave a Comment


root@web2:$ rm pe-warn-*.bz2
-bash: /bin/rm: Argument list too long

This peoblem happens when you are trying to delete too many files in a directory at the same time – it seems rm has special limits …

To solve the problem:
Use:

1
find . -name 'pe-warn-*.bz2' | xargs rm

find . -name 'pe-warn-*.bz2' | xargs rm

or

1
find . -name "pe-warn-*.bz2" -delete

find . -name "pe-warn-*.bz2" -delete

Filed Under: Bash, Debian, Linux, Ubuntu Tagged With: bash, limit, rm

  • « Previous Page
  • 1
  • 2
  • 3
  • Next Page »
Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok