Ubuntu

How to get your Dell Service Tag

There are those times you need the service tag from a system such as a noteboot, server, or pc and just can’t get to it.  Or… taking the “I’m not getting up for this method”.

Using the Windows Management Instrumentation Command-line (WMIC) you can pull this information right from the command prompt. Simply type the following:

wmic bios get serialnumber

You can also do something similar in Linux..  In my case I use Ubuntu and type:

dmidecode -s system-serial-number

Please note that in both systems you may need to elevate your rights to issues these commands.

PS3 Media Server (Again)

It’s been about 2 years now and well it was time for me to rebuild my PS3 Media Server
The last time I made a write up about this; I gave a few steps and left some out. Here is my rebuild and steps I took to get it working.

I started off by installing a fresh copy Ubuntu Server.
After the updates, I was ready to go.

Like the last build I did the following:

apt-get install mplayer mencoder ffmpeg vlc vlc-nox
apt-get install openjdk-7-jre-headless
apt-get install sshfs smbfs

The ssh and smb fs is used to mount remote storage locally if needed

After that has completed I move my way over to http://www.ps3mediaserver.org/ choosing the latest Linux build.
Latest Version:   PS3 Media Server 1.52.1 – Linux/Unix

Extracting this with tar xzf <filename>
I then moved the pms files to a new folder location.

/opt/pms/ ; you can also choose your own, and it’s entirely up to you.

mkdir /opt/psm
mv ~/pms-linux-x.xx.x/ /opt/pms

Then I changed into the directory

cd /opt/pms

I make the following scripts executable

chmod +x PMS.sh
chmod +x linux/tsmuxer

I then modify the PMS.conf file

cp /opt/pms/PMS.conf /opt.pms/PMS.conf.backup
nano /opt/pms/PMS.conf ; there are many options here, I’m sorry but I am not going into this during this post. I will suggest to you to set “thumbnails = false” to speed things up

The only thing I had changed in this file was the directory where I have my video media files

/media/video ; this data doesn’t exist on my server. It’s shared on another system and I am connecting to this using smbfs (smbmount)

Now it’s time to setup the startup script

cd /etc/init.d
nano startpms *this will create a new file to start the server*

Add the following lines:

#!/bin/bash
smbmount //host/video/ /media/video/ -o user=username,pass=1234pass
cd /opt/pms-1.52.1/
nohup ./PMS.sh &
exit

Save the file and make it executable by typing: chmod +x startpms
Now you issue the following command: something I did not do the last time

update-rc.d startpms

After a quick reboot of my server, I again have a running DLNA / UPNP Media Server running on a Linux box.

My ClamAV Installation and Configuration on Ubuntu Server

To install ClamAV run the following command

apt-get update
apt-get install clamav

Manually update virus databases

freshclam

You will see ClamAV update process started
To manually scan files/folders for viruses

clamscan -r /location_of_files_or_folders

Sample Output

———– SCAN SUMMARY ———–
Known viruses: 1184347
Engine version: 0.97.3
Scanned directories: 60
Scanned files: 334
Infected files: 0
Data scanned: 309.25 MB
Data read: 3539.62 MB (ratio 0.09:1)
Time: 124.897 sec (2 m 4 s)

Automatically scan files/folders for viruses

e.g. Automatically scan files/folders for viruses at midnight everyday
* * * * * means minute hour date month year
you need to edit your crontab file

crontab -e

Append the following line at the end of file
00 00 * * * clamscan -r /location_of_files_or_folder

I Installed Webmin on Ubuntu Server

Webmin is a web interface for configuring your linux box. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more, and all can be done remotely.  I am new to this and will update more as time goes by.  For now this is rather nice

But first you will need some perl-related libraries required to run webmin

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python

and remember my friend you may need to run the sudo command before installing if you are not running at as root.

Now we need to head over to the webmin website to obtain the install package.  I’m running Ubuntu for my server so I will be using a DEB version of webmin.  Download from the site and ftp scp it over to the server or simply

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.580_all.deb

The above was the most recent version at the time of my initial install and creation of this post

Once you have the package where you need it run the following command to install

dpkg –install webmin_1.580_all.deb

The install will be done automatically to /usr/share/webmin, the administration username set to root and the password to your current root password. You should now be able to login to Webmin at the URL http://<<hostname or ip>:10000/.

 

Byobu

Byobu is a light, powerful, text-based window manager based on GNU Screen. Using Byobu, you can quickly create and move between different windows over a single SSH connection or TTY terminal, monitor dozens of important statistics about your system, detach and reattach to sessions later while your programs continue to run in the background.

Byobu can be configured to run by default at every text login (SSH or TTY). That behavior can be toggled with the byobu-enable and byobu-disable commands.

In your remote ssh session type the following

byobu-enable

or

byobu-disable

Byobu displays two lines at the bottom of your screen. The upper one is the Caption line, and the lower one is the Hard Status

The Caption line shows your open windows, and highlights the one upon which you are focused, and optionally displays your user name, host name, IP address, and a hint that there is a Menu available if you press F9.

The Hard Status line consists of color coded output and symbols with configurable and dynamically updated facts, statistics, and information about the local system. See the Status Notifications section below for more information.

Some users may find the Hard Status line distracting. The byobu-quiet command will disable the display of the Hard Status. Append –undo to revert this configuration change.

Some other users may find both the Hard Status and Caption distracting. In this case, the byobu-silent command will disable both lines. Again, append –undo to revert the change.

 

Byobu provides a comprehensive, advanced set of commands bound to the F-keys on most keyboards.

F2 Create a new window
F3 Move to the next window
F4 Move to the previous window
F5 Refresh all status notifications
F6 Detach from the session and logout
Shift-F6 Detach from the session, but do not logout
F7 Enter scrollback/search mode
F8 Rename the current window
F9 Launch the Byobu Configuration Menu
F12 GNU Screen’s Escape Key
Alt-Pageup Scroll back through this window’s history
Alt-Pagedown Scroll forward through this window’s history
Shift-F2 Split the screen horizontally
Ctrl-F2 Split the screen vertically
Shift-F3 Move focus to the next split
Shift-F4 Move focus to the previous split
Shift-F5 Collapse all splits
Ctrl-F5 Reconnect any SSH/GPG sockets or agents
Ctrl-a-! Toggle all of Byobu’s keybindings on or off

Can you ‘find’ it

Today I had someone ask me how to find a file on the Linux box that had been using.

I quickly responded to this person with the following

find -name “somefile.example”

 

I just thought I’d share more right from the man pages.

findutils is actually made up of 4 utilities:

  1. find – search for files in a directory hierarchy
  2. locate – list files in databases that match a pattern
  3. updatedb – update a file name database
  4. xargs – build and execute command lines from standard input

 

The Basics

The syntax for using find is:

 

The 3 options [-H] [-L] [-P] are not commonly seen but should at least be noted if only to realise that the -P option will be thedefault unless another option is specified:

  • -H : Do not follow symbolic links, except while processing the command line arguments.
  • -L : Follow symbolic links.
  • -P : Never follow symbolic links: the default option.

The option [path…] refers to the particular location that you wish to search, whether it be your $HOME directory, a particular directory such as /usr, your present working directory which can simply be expressed as ‘.’ or your entire computer which can be expressed as ‘/’.

The option [expression] refers to one or a series of options which effect the overall option of the find command. These options can involve a search by name, by size, by access time or can also involve actions taken upon these files.

 

Locating Files by Name

The most common use of find is in the search for a specific file by use of its name. The following command searches the home directory and all of its subdirectories looking for the file mysong.ogg:

 

It is important to get into the habit of quoting patterns in your search as seen above or your search results can be a little unpredictable. Such a search can be much more sophisticated though. For example if you wished to search for all of the ogg files in your home directory, some of which you think might be named ‘OGG’ rather than ‘ogg’, you would run:

 

Here the option ‘-iname’ performs a case-insensitive search while the wildcard character ‘*’ matches any character, or number of characters, or zero characters. To perform the same search on your entire drive you would run:

 

This could be a slow search depending on the number of directories, sub-directories and files on your system. This highlights an important difference in the way that find operates in that it examines the system directly each time unlike programs like locate or slocate which actually examine a regularly updated database of filnames and locations.

 

Locating Files by Size

Another possible search is to search for files by size. To demonstrate this we can again search the home directory for Ogg Vorbis files but this time looking for those that are 100 megabytes or larger:

 

There are several options with -size, I have used ‘M’ for ‘megabytes’ here but ‘k’ for ‘kilobytes’ can be used or ‘G’ for ‘Gigabytes’. This search can then be altered to look for files only that are less than 100 megabytes:

 

Are you starting to see the power of find, and the thought involved in constructing a focused search? If you are interested there is more discussion of these combined searches in the Advanced Usage section below.

 

Locating Files by Access Time

It is also possible to locate files based on their access time or the time that they were last used, or viewed by the system. For example to show all files that have not been accessed in the $HOME directory for 30 days or more:

 

This type of search is normally more useful when combined with other find searches. For example one could search for all ogg files in the $HOME directory that have an access time of greater than 30 days:

 

The syntax works from left to right and by default find joins the 2 expressions with an implied “and”. This is dealt with in more depth in the section below entitled “Combining Searches”.

 

Advanced Usage

The sections above detail the most common usage of find and this would be enough for most searches. However there are many more possibilities in the usage of find for quite advanced searches and this sections discusses a few of these possibilities.

 

Combining Searches

It is possible to combine searches when using find with the use of what is known in the find man pages as operators. The classic example is the use of a logical AND syntax:

 

This find search performs initially a case insensitive search for all the ogg files in your $HOME directory and for every true results it then searches for those with a size of 20 megabytes and over. This contains and implied operator which could be written joined with an -a. This search can be altered slightly by use of an exclamation point to signify negation of the result:

 

This performs the same search as before but will look for ogg files that are not greater than 20 megabytes. It is possible also to use a logical OR in your find search:

 

This will perform a case insensitive search in the $HOME directories and find all files that are either ogg OR mp3 files. There is great scope here for creating very complex and finely honed searches and I would encourage a through reading of the find man pages searching for the topic OPERATORS.

 

Acting On The files

One advanced but highly useful aspect of find usage is the ability to perform a user-specified action on the result of a find search. For example the following search looks for all ogg vorbis files in the $HOME directory and then uses -exec to pass the result to the du program to give the size of each file:

 

This syntax is often used to delete files by using -exec rm -rf but this must be used with great caution, if at all, as recovery of any deleted files can be quite difficult.

 

Using xargs

When using a really complex search it is often a good idea to use another member of the findutils package: xargs. Without its use the message Argument list too long could be seen signalling that the kernel limit on the combined length of a commandline and its environment variables has been exceeded. xargs works by feeding the results of the search to the subsequent command in batches calculated on the system capabilities (based on ARG_MAX). An example:

 

This example searches the /tmp folder for all mp3 files and then deletes them. You will note the use of both -print0 and xargs -0which is a deliberate strategy to avoid problems with spaces and/or newlines in the filenames. Modern kernels do not have the ARG_MAX limitation but to keep your searches portable it is an excellent idea to use xargs in complex searches with subsequent commands.

Source:  https://help.ubuntu.com/community/find

Ethstatus

Console-based ethernet statistics monitor.Ethstatus is a console-based monitoring utility for displaying statistical data of the ethernet interface on a quantity basis. It is similar to iptraf but is meant to run as a permanent console task to monitor the network load.

Install Ethstatus in Ubuntu

sudo apt-get install ethstatus

If you want to see your your network card status from command line just enter the following command

ethstatus

 

 

VLC

There is no real need to post this because of how awesome it is.

By now most of you know this, but for those of you who do not…

It plays  almost anything!   I use it both in Windows and Ubuntu.

Simple to install, simple to use.

In Ubuntu

sudo apt-get install vlc

 

In Windows

Find your way over to http://www.videolan.org/vlc/ and download / then install and use.

 

[SOLVED] Segmentation faulty tree…

I had this issue where I could not install anything new in my Ubuntu server. After some searching I come to lean that the packages cache seemed to be corrupted

# symptom is something such as this
root@media:~# apt-get update
root@media:~# apt-get install htop

Reading package lists… Done
Segmentation faulty tree… 50%

# and this is what fixed the problem
# you need to be as root or su into root
sudo rm /var/cache/apt/*.bin

I am happy again.

Install VMWare Tools Ubuntu Server

This is a little short on how to install the ESX VMWare Tools on Ubuntu Server

If you are not running as the ‘root’ user you will need to change into super user

Lets start —

 

# if not running as ‘root’ change into super user
sudo su

# update your sources
apt-get update

# you will need to install the build tools
apt-get install build-essential
apt-get install linux-headers-server

# we can now install the tools from the virtual cd
# in esx click on the vm-guest and then select guest
# followed by install/upgrade VMWare tools
# you will need to mount the tools
mount /dev/cdrom /media/cdrom

# now copy the tools to the temp path of your server
# use tab completion to get the correct tools version
cp /media/cdrom/VMWareTools-.x.x.x-xxxx.tar.gz /tmp

# change into the tmp directory
cd /tmp

# extract the install files
# use tab completion to get the correct tools version
tar -zxf VMWareTools-.x.x.x-xxxx.tar.gz

# change into the extracted directory
# use tab completion to get the correct directory
cd vmware-tools-distrib

# now start the installing by typing the following
./vmware-install.pl

# you will see the following message
:: Installing VMware Tools. ::

# accept the defaults
:: Initializing… ::

 

– Done –