←October→
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
|
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
|
|
|
|
Mon, Jun 24, 2024 10:30 pm
Installing OpenSSH server software on an Ubuntu Linux system
To set up an
Ubuntu
Linux system as a
Secure
Shell (SSH) server, you can take the following steps:
- Open a terminal window.
- In the terminal window, issue the command
sudo apt-get install openssh-server
.
- Enable and start the ssh server service by
issuing the command
sudo systemctl enable ssh --now
.
If you wish to enable the service, but not start it immediately, you
can omit the --now
at the end of the command, i.e., you
can use sudo systemctl enable ssh
and then later issue
the command sudo systemctl start ssh
to start the service.
[ More Info ]
[/os/unix/linux/ubuntu]
permanent link
Sun, Jun 23, 2024 7:19 pm
Determining the version of an installed package on an Ubuntu Linux system
If you wish to view information for a
package installed
on an Ubuntu Linux system,
you can use the command apt show packageName
or
dpkg -s packageName
where packageName is the
name of the relevant package. If you are only interested in the version number
for a package, you can
pipe the output
of either command into the grep
command.
$ apt show net-tools
Package: net-tools
Version: 1.60+git20181103.0eebece-1ubuntu5
Priority: optional
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: net-tools Team <team+net-tools@tracker.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 819 kB
Depends: libc6 (>= 2.34), libselinux1 (>= 3.1~)
Homepage: http://sourceforge.net/projects/net-tools/
Task: ubuntukylin-desktop
Download-Size: 204 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
Description: NET-3 networking toolkit
This package includes the important tools for controlling the network
subsystem of the Linux kernel. This includes arp, ifconfig, netstat,
rarp, nameif and route. Additionally, this package contains utilities
relating to particular network hardware types (plipconfig, slattach,
mii-tool) and advanced aspects of IP configuration (iptunnel, ipmaddr).
.
In the upstream package 'hostname' and friends are included. Those are
not installed by this package, since there is a special "hostname*.deb".
$ apt show net-tools | grep "Version:"
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Version: 1.60+git20181103.0eebece-1ubuntu5
$ dpkg -s net-tools
Package: net-tools
Status: install ok installed
Priority: important
Section: net
Installed-Size: 800
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: foreign
Version: 1.60+git20181103.0eebece-1ubuntu5
Depends: libc6 (>= 2.34), libselinux1 (>= 3.1~)
Description: NET-3 networking toolkit
This package includes the important tools for controlling the network
subsystem of the Linux kernel. This includes arp, ifconfig, netstat,
rarp, nameif and route. Additionally, this package contains utilities
relating to particular network hardware types (plipconfig, slattach,
mii-tool) and advanced aspects of IP configuration (iptunnel, ipmaddr).
.
In the upstream package 'hostname' and friends are included. Those are
not installed by this package, since there is a special "hostname*.deb".
Homepage: http://sourceforge.net/projects/net-tools/
Original-Maintainer: net-tools Team <team+net-tools@tracker.debian.org>
$ dpkg -s net-tools | grep "Version:"
Version: 1.60+git20181103.0eebece-1ubuntu5
$
Another command that will show you the installed version of a package
on a Ubuntu systems is apt-cache policy packageName
.
$ apt-cache policy net-tools
net-tools:
Installed: 1.60+git20181103.0eebece-1ubuntu5
Candidate: 1.60+git20181103.0eebece-1ubuntu5
Version table:
*** 1.60+git20181103.0eebece-1ubuntu5 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
$
[/os/unix/linux/ubuntu]
permanent link
Thu, Mar 14, 2024 9:29 pm
Checking fan speeds and temperatures in a Linux system
A user reported the sound from a Linux
CentOS server was loud. I
thought the noise was likely from a fan in the system. The lm_sensors package
provides the capability to check
central
processing unit (CPU) temperatures and fan speeds for systems running
a Linux operating system.
I first checked to see if the package was installed and found it was
installed.
$ rpm -qi lm_sensors
Name : lm_sensors
Version : 3.3.4
Release : 11.el7
Architecture: x86_64
Install Date: Sat 15 Oct 2016 12:14:14 PM EDT
Group : Applications/System
Size : 418761
License : LGPLv2+ and GPLv3+ and GPLv2+ and Verbatim and Public domain
Signature : RSA/SHA256, Sat 14 Mar 2015 04:15:54 AM EDT, Key ID 24c6a8a7f4a80eb5
Source RPM : lm_sensors-3.3.4-11.el7.src.rpm
Build Date : Thu 05 Mar 2015 10:48:12 PM EST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.lm-sensors.org/
Summary : Hardware monitoring tools
Description :
The lm_sensors package includes a collection of modules for general SMBus
access and hardware monitoring.
$
I then ran the sensors
command to view the CPU temperature and
fan speeds. The CPU and motherboard (MB) temperatures were high and
the output showed 0 RPM for the chassis fan speed, indicating either there
was no sensor monitoring its speed or it had stopped rotating.
$ sensors
atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage: +1.28 V (min = +0.85 V, max = +1.60 V)
+3.3 Voltage: +3.36 V (min = +2.97 V, max = +3.63 V)
+5 Voltage: +5.17 V (min = +4.50 V, max = +5.50 V)
+12 Voltage: +12.41 V (min = +10.20 V, max = +13.80 V)
CPU FAN Speed: 2518 RPM (min = 0 RPM, max = 7200 RPM)
CHASSIS FAN Speed: 0 RPM (min = 800 RPM, max = 7200 RPM)
CPU Temperature: +79.5°C (high = +60.0°C, crit = +95.0°C)
MB Temperature: +61.0°C (high = +45.0°C, crit = +95.0°C)
$
References:
-
How to find fan speed in Linux for CPU and GPU
By: Vivek Gite
Last updated: February 11, 2021
nixCraft
[/os/unix/linux/utilities]
permanent link
Sat, Mar 09, 2019 4:25 pm
Installing and using cdparanoia to rip CDs on a CentOS Linux system
If you need to
rip a CD
from a command-line interface (CLI) on a
CentOS Linux
system,
cdparanoia will allow you to do so. The cdparanoia
CD ripper
program will allow you to produce Waveform Audio File Format, i.e., .WAV, files
from the tracks on a CD. You can use the
yum package management software to install the software
with by issuing the command yum install cdparanoia
from the
root account.
[ More Info ]
[/os/unix/linux/centos/music]
permanent link
Fri, Mar 08, 2019 9:12 pm
Accessing the RPM Fusion repository from a CentOS system
Sometimes you may find that a software
package
that you would like to use on a
CentOS Linux
system is unavailable from the default
software repositories, aka "repos." In such cases adding alternative
repos, such as Extra Packages
for Enterprise Linux (EPEL) or
RPM Fusion may allow
you to locate the desired package. E.g., the
VLC media player is available in the RPM Fusion repository, but not
the default ones nor in EPEL. RPM Fusion has two separate software
repositories, one that contains
free and open-source software (FOSS) and
another named "nonfree". Packages in the "nonfree" repository still
won't cost you anything, but there may be restrictions on the use of the
software, e.g., you may be forbidden from using the software for commercial
use. The RPM Fusion site defines the nonfree repo as being 'for redistributable
software that is not Open Source Software (as defined by the Fedora Licensing
Guidelines); this includes software with publicly available source-code that
has "no commercial use"-like restrictions.'
[ More Info ]
[/os/unix/linux/centos]
permanent link
Tue, Jan 01, 2019 10:42 pm
Creating new directories for a new year
I have a number of log directories where I store log files where the directory
name is the current year. On the last day of the old year, I want to create
new directories named for the upcoming year. I use the following
Bash
script to create those directories. Since I have several email log directories,
I use a for
loop to create a directory named after the upcoming year in each one.
#!/bin/bash
#
# Create a new directory corresponding to the upcoming year on December 31 of
# every year
newyear=$(date --date=tomorrow +%Y)
echo $newyear
# Apache logs
# Check on whether the directory for the current year exists and, if it doesn't,
# create it.
if [ ! -d /home/jdoe/www/logs/apache/"$newyear" ]; then
mkdir /home/jdoe/www/logs/apache/"$newyear"
chown apache /home/jdoe/www/logs/apache/"$newyear"
chgrp apache /home/jdoe/www/logs/apache/"$newyear"
fi
# Email logs
# Create an array holding the names of the 4 directories within which
# subdirectories will be created using the name of the new year. E.g.,
# /home/jdoe/www/logs/mail/sendmail_stats/2019
logdirs=( "dnsbl_count" "sendmail_stats" "smlogstats" "smreject" )
for i in "${logdirs[@]}"
do :
# Check on whether the directory for the current year exists and, if it
# doesn't, create it.
if [ ! -d /home/jdoe/www/logs/mail/$i/"$newyear" ]; then
mkdir /home/jdoe/www/logs/mail/$i/"$newyear"
chown jdoe /home/jdoe/www/logs/mail/$i/"$newyear"
chgrp jdoe /home/jdoe/www/logs/mail/$i/"$newyear"
fi
done
I then have a
crontab entry containing the following line that will result in the
Bash script above, named end-of-year-dirs, being run at 7;00 AM on December 31
of each year.
0 7 31 DEC * /root/bin/end-of-year-dirs
Related articles:
-
Loop through an array in Bash
-
CRONTAB
-
crontab -e
-
smlogstats
[/os/unix/bash]
permanent link
Fri, Jun 22, 2018 10:51 pm
Regular expression to find words/strings not ending with a character
If you wish to find
strings at the end of a line that don't end with a
particular character, you can use a
bracket expresion with a
caret
character after the
left square bracket in a
regular expression.
Metacharacter |
Description |
[^ ] |
Matches a single character that is not contained
within the brackets. For example, [^abc] matches any character other
than "a", "b", or "c". [^a-z] matches any single character that is
not a lowercase letter from "a" to "z". Likewise, literal characters
and ranges can be mixed. |
[ More Info ]
[/os/unix/commands]
permanent link
Sun, Feb 04, 2018 11:03 pm
Run a cronjob at the end of every year
At the end of every year, I need to create some new directories to hold
log files with the directory name reflecting the new year on a
CentOS
Linux system. To create those directories on the last day of the year,
December 31, I can use the cron utility found on Linux/Unix and OS X/MacOS systems
to schedule a cronjob to run on the last day of the year. I can edit the
crontab file
that holds jobs to be run at a scheduled time or times by issuing the
crontab command
crontab -e
, which will allow me to edit the file with the
vi editor.
If the vi editor is the default editor, which it likely is, but you
are unfamiliar with that editor, you can change the editor for the current
login session to the GNU nano text editor, which may be easier to use for
someone unfamiliar with the vi text editor, by issuing the following command at
the command line.
export EDITOR="/usr/bin/nano"
The value will be reset when you log off or you can reset it manually
with the command below:
export EDITOR="/usr/bin/vi"
I can put the following line in the crontab file to run my script named
end-of-year-dirs
at 7:00 AM on December 31 of every year. When
you add a new entry, be sure to hit the Enter key at the end of the
line.
0 7 31 DEC * /home/jdoe/scripts/end-of-year-dirs
[ More Info ]
[/os/unix/commands]
permanent link
Thu, Jan 18, 2018 11:55 pm
Viewing the login history for a user on a Linux or OS X system
If you want to see the IP addresses from which logins have occurred on a
Linux or OS X system, you can use the
last command. E.g.:
$ last ann
ann tty2 Thu Jan 5 20:23 - 20:27 (00:03)
ann tty2 Thu Jan 5 20:05 - 20:06 (00:00)
ann tty2 Thu Jan 5 20:01 - 20:02 (00:00)
ann pts/0 8.25.222.2 Sun Oct 30 10:43 - 16:59 (06:16)
ann pts/0 192.168.0.2 Tue Oct 11 12:02 - 12:03 (00:00)
ann pts/0 192.168.0.2 Tue Oct 11 12:01 - 12:01 (00:00)
ann pts/32 192.168.1.6 Sat Jun 11 20:03 - 20:38 (00:35)
ann pts/32 192.168.1.6 Sat Jun 11 13:23 - 14:22 (00:58)
ann pts/14 192.168.1.5 Sun Feb 14 17:05 - 18:28 (6+01:22)
ann pts/6 8.23.51.9 Sun Nov 8 09:23 - 10:16 (00:52)
ann pts/6 8.23.51.9 Sat Nov 7 08:54 - 16:42 (07:48)
ann pts/7 8.23.51.9 Fri Nov 6 16:47 - 16:49 (00:02)
ann pts/6 8.23.51.9 Fri Nov 6 15:48 - 23:33 (07:44)
ann pts/0 :0 Thu Sep 10 15:25 - 12:38 (129+22:13)
ann :0 :0 Thu Sep 10 15:24 - 12:38 (129+22:14)
ann pts/5 :0 Sun Aug 23 11:08 - crash (18+04:03)
ann pts/4 :0 Sat Aug 22 21:16 - crash (18+17:56)
ann pts/3 :0 Sat Aug 22 09:14 - crash (19+05:58)
ann :0 :0 Sat Aug 22 09:07 - crash (19+06:05)
ann pts/2 192.168.1.6 Sun Jul 19 15:41 - 20:59 (1+05:18)
ann pts/2 192.168.1.5 Mon Jun 22 21:28 - 20:17 (18+22:49)
ann pts/2 192.168.1.6 Fri Feb 6 21:26 - 21:26 (00:00)
ann pts/5 192.168.0.3 Wed Nov 5 21:07 - 22:15 (01:08)
wtmp begins Sun Oct 5 20:09:11 2014
$
[ More Info ]
[/os/unix/commands]
permanent link
Fri, Jan 12, 2018 10:55 pm
Viewing only the files created today on a Linux system
I sometimes need to see only the files created or modified today in a
directory. On a Linux system, you can
pipe
the output of the
ls command
into the grep
command looking for just today's date in the input to the grep command as
shown below:
$ ls -al --time-style=+%D ~/Documents/*.zip | grep $(date +%D)
-rw-r--r--. 1 joe joe 269338 01/12/18 /home/joe/Documents/gloves.zip
$
You can specify how the date is displayed with +format
where format is a particular format in which you want the date
displayed - see
Formatting the output from the date command on a Linux system. If you
use +%D
, the date will be displayed as m/d/y
, i.e.,
month/day/year, e.g. 01/12/18 for January 12, 2018. By then using the
grep command to search for that value, you can limit the displayed files
to only those created or modified today.
[ More Info ]
[/os/unix/commands]
permanent link
Privacy Policy
Contact