OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

November 1, 2009

OpenSUSE Linux: Quick Zypper Tutorial

by @ 1:21 am. Filed under bash, command-line, SUSE Tips & Tricks

OpenSUSE Linux provides a command-line method of managing repositories and packages. This tool is called zypper. The following is a basic tutorial by example of how to use zypper.

Repository Management

To list repositories:

[1342][root@dev:/home/scott]$ zypper repos
#  | Alias             | Name                  | Enabled | Refresh
---+-------------------+-----------------------+---------+--------
1  | Enlightenment CVS | Enlightenment CVS     | Yes     | Yes    
2  | OpenSUSE_11.1_ISO | OpenSUSE 11.1 ISO     | Yes     | No     
3  | Packman           | Packman               | Yes     | Yes    
4  | Window_Managers   | Window Managers       | Yes     | Yes    
5  | XFCE4             | XFCE4                 | Yes     | Yes    
6  | aterm             | aterm                 | Yes     | Yes    
7  | home:danci1973    | home:danci1973        | Yes     | Yes    
8  | home:dauphin      | home:dauphin          | Yes     | Yes    
9  | home:jnelson-suse | home:jnelson-suse     | Yes     | Yes    
10 | mozilla           | mozilla               | Yes     | Yes    
11 | openSUSE 11.1-0   | openSUSE 11.1-0       | Yes     | Yes    
12 | repo-debug        | openSUSE-11.1-Debug   | No      | Yes    
13 | repo-non-oss      | openSUSE-11.1-Non-Oss | Yes     | Yes    
14 | repo-source       | openSUSE-11.1-Source  | No      | Yes    
15 | repo-update       | openSUSE-11.1-Update  | Yes     | Yes    
[1402][root@dev:/home/scott]$

To add a repository (we’re going to use Packman as an example):

[1341][root@dev:/home/scott]$ zypper addrepo "http://packman.unixheads.com/suse/11.1/" Packman
Adding repository 'Packman' [done]
Repository 'Packman' successfully added
Enabled: Yes
Autorefresh: No
URI: http://packman.unixheads.com/suse/11.1/

[1341][root@dev:/home/scott]$ 

To turn on autorefresh, because it’s disabled by default (again, with Packman):

[1341][root@dev:/home/scott]$ zypper modifyrepo -r Packman
Autorefresh has been enabled for repository 'Packman'.
[1342][root@dev:/home/scott]$

To refresh a repo manually:

[1342][root@dev:/home/scott]$ zypper refresh -r Packman
Retrieving repository 'Packman' metadata [done]
Building repository 'Packman' cache [done]
Specified repositories have been refreshed.
[1342][root@dev:/home/scott]$

Leave out the “-r” and leave off the name of the repo if you want to refresh all of them.

To remove a repository:

[1337][root@dev:/home/scott]$ zypper rr Packman
Removing repository 'Packman' [done]
Repository 'Packman' has been removed.
[1337][root@dev:/home/scott]$ 

Package Management

To search for a package (id3v2, in this example):

[1224][root@dev:/home/scott]$ zypper search id3v2
Loading repository data...
Reading installed packages...

S | Name  | Summary                              | Type   
--+-------+--------------------------------------+--------
  | id3v2 | A Command Line Editor for ID3V2 Tags | package
[1229][root@dev:/home/scott]$

To get information on a package (again, id3v2):

[1229][root@dev:/home/scott]$ zypper info id3v2
Loading repository data...
Reading installed packages...


Information for package id3v2:

Repository: openSUSE 11.1-0
Name: id3v2
Version: 0.1.11-77.60
Arch: x86_64
Vendor: openSUSE
Installed: No
Status: not installed
Installed Size: 79.0 K
Summary: A Command Line Editor for ID3V2 Tags
Description: 
ID3 tags are found in MP3 files. They canstore information about what band recorded the song, the song name, and more.

ID3V1 tags are seriously deficient as to the kind of and length ofinformation that they can store. This is a tool for editing ID3V2tags in Linux.


[1333][root@dev:/home/scott]$ 

To install a package:

[1333][root@dev:/home/scott]$ zypper install id3v2
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  id3v2 


Overall download size: 30.0 K. After the operation, additional 79.0 K will be used.
Continue? [YES/no]: 
Retrieving package id3v2-0.1.11-77.60.x86_64 (1/1), 30.0 K (79.0 K unpacked)
Retrieving: id3v2-0.1.11-77.60.x86_64.rpm [done]          
Installing: id3v2-0.1.11-77.60 [done]
[1334][root@dev:/home/scott]$

To remove a package:

[1334][root@dev:/home/scott]$ zypper remove id3v2
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  id3v2 


After the operation, 79.0 K will be freed.
Continue? [YES/no]: 
Removing id3v2-0.1.11-77.60 [done]
[1336][root@dev:/home/scott]$

These are some common zypper commands that will help you manage your repositories and packages from the command-line.

October 28, 2009

Slick Linux Virtual Terminal: aterm

by @ 1:32 am. Filed under command-line, Linux tips, SUSE Tips & Tricks, terminal

In the search for a full weight loss program for my window manager (I’m switching from KDE 3.5 to XFCE4), it became clear that another terminal would have to replace Konsole. After 11 full minutes of considerable thought, agonizing contemplation, deliberation and extensive research, aterm became the obvious choice.

aterm looked interesting to me because it has a small memory footprint. Konqueror takes up about 7 times the RAM that aterm does, while xterm takes over twice the RAM that aterm does. aterm also has very little dependencies. Additionally, it supports pseudo-transparencies, while remaining very responsive and quick.

The first thing you want to do is install aterm. This does not appear to be available on OpenSUSE 11.1 by default. But just add the following repo:

http://download.opensuse.org/repositories/home:/-miska-:/Release/openSUSE_11.1

Add the repo as root like this:

[1049][root@laptop:~]$ zypper addrepo http://download.opensuse.org/repositories/home:/-miska-:/Release/openSUSE_11.1 aterm
Adding repository 'aterm' [done]
Repository 'aterm' successfully added
Enabled: Yes
Autorefresh: No
URI: http://download.opensuse.org/repositories/home:/-miska-:/Release/openSUSE_11.1

[1049][root@laptop:~]$

Refresh the repo:

[1049][root@laptop:~]$ zypper refresh aterm
Retrieving repository 'aterm' metadata [done]
Building repository 'aterm' cache [done]
Specified repositories have been refreshed.
[1050][root@laptop:~]$

Install aterm:

[1112][root@dev:/home/scott]$ zypper install aterm
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  AfterStep_applets_all 


Overall download size: 310.0 K. After the operation, additional 1.1 M will be used.
Continue? [YES/no]: 
Retrieving package AfterStep_applets_all-070412-5.13.x86_64 (1/1), 310.0 K (1.1 M unpacked)
Retrieving: AfterStep_applets_all-070412-5.13.x86_64.rpm [done]         
Installing: AfterStep_applets_all-070412-5.13 [done]
[1112][root@dev:/home/scott]$ 

Now, run aterm in a terminal window or something to make sure it’s installed.

On to the configuration (which is the cool part, really).

First, determine which font you want to use by running xfontsel. It opens up a window where you can fine-tune the font you want aterm to use.

Then, you’ll want to set up your configuration file. I use .Xresources although there are others you can use.

Copy and paste this into your .Xresources file, and then adjust as necessary:

aterm*font: -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*
aterm*font1: -*-*-*-*-*-*-2-*-*-*-*-*-*-*
aterm*font2: -misc-fixed-*-r-normal-*-8-*-*-*-*-*-iso8859-*
aterm*font3: -b&h-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*
aterm*font4: -*-screen-bold-r-normal-*-16-*-*-*-*-*-iso8859-*
aterm*font5: -*-lucidatypewriter-medium-*-*-*-18-*-*-*-*-*-*-*
aterm*font6: -*-lucidatypewriter-medium-*-*-*-20-*-*-*-*-*-*-*
aterm*font7: -dec-terminal-bold-r-normal-*-14-*-*-*-*-*-iso8859-*

aterm*background: black
aterm*foreground: white
aterm*pointerColor: red
aterm*pointerColorBackground: black
aterm*cursorColor: blue
aterm*internalBorder: 3
aterm*loginShell: true

! Do you want a scrollbar?
aterm*scrollBar: true
aterm*scrollKey: true

! How many lines do you want to save in the buffer?
aterm*saveLines: 32767
aterm*multiClickTime: 250

! Do you want transparency?
aterm*transparent: true

! Do you want transparency in the scrollbar?
aterm*transpscrollbar: true

! How much transparency do you want (in percent)?
aterm*shading:20

!aterm*tintingType: true
!aterm*tinting: #a07040

! How many characters wide and tall should your window be?
aterm*geometry: 80x40

! Do you want a visual bell rather than an audio bell?
aterm*visualBell: true

Hopefully, it’s apparent that you can use exclamation points for comments.

Everything in this sample .Xresources config file should be fairly self-explanatory.

aterm takes many of the same configuration directives as xterm. So if you see an xterm directive you want aterm to use, throw it in the .Xresources file and reload it. You reload the .Xresources file with the following command:

[1058][scott@dev:~]$ xrdb -merge .Xresources
[1058][scott@dev:~]$ 

If you are running that command in an open aterm window, you will have to close the window and re-run aterm.

aterm is very quick and responsive, looks nice, and doesn’t take up too much memory. Take a look at it, play around with it, and enjoy it.

October 21, 2009

SSH Tip for the Day

by @ 8:14 am. Filed under bash, command-line, Linux tips, ssh tips

When you are forwarding ports through a tunnel, either locally or remotely (i.e., with the -L or -R switches), you can modify the session real-time. The way that you do this is after you start the session, you press SHIFT + ` + c (The ` key also has a ~ in it, which is the actual keypress sent to the session). If it doesn’t work the first time, press ENTER a couple of times and try it again. Once you get the “ssh>” prompt, type “?” for the commands you can put in. Here’s an example session:

[0908][scott@dev:~]$ ssh -R 8080:suseblog.com:8080 scott@suseblog.com
Password:
Last login: Thu Oct 15 11:59:43 2009 from 67.214.232.162
Have a lot of fun...
[1109][scott@mail:~]$ [PRESS SHIFT + ` + c HERE]
ssh> ?
Commands:
      -L[bind_address:]port:host:hostport    Request local forward
      -R[bind_address:]port:host:hostport    Request remote forward
      -KR[bind_address:]port                 Cancel remote forward
[PRESS ENTER HERE]
[1110][scott@mail:~]$ [PRESS SHIFT + ` + c HERE]
ssh> -R8080:letslearnlinux.com:1080
Forwarding port.

[1110][scott@mail:~]$

OpenSSH has got to be one of the freakin’ sweetest tools *EVAR*. Anyway, enjoy!

October 16, 2009

[Linux] – Socks Proxy in One Command

by @ 3:54 pm. Filed under command-line, Linux tips, ssh tips

If you have difficulty browsing on your Linux workstation at work, say, because of filters and such, this will make your day. One other thing is that you need a Linux server that is outside your network at work. Once you have this, you can use ssh to create a socks proxy. Even as an un-privileged user, type in this command:

ssh -D 8080 <username>@<host>

Replace <username> with your username and <host> with your remote Linux server host name. Once that’s successful, pop open Firefox. Go to the EDIT Menu => Preferences. Select the ADVANCED button, then go to the “Network” tab. Click the “Settings” button. Select the “Manual Proxy Configuration” radio button. In the SOCKS Host, put in either the IP or the domain name of your remote Linux box. In the port, put in 8080, as that’s the one we used.

Click “OK” and close everything (except firefox). You should now be able to browse wherever your little heart desires.

One thing to note. NS queries are NOT proxied. So if your admins are looking at the name server lookup requests, you could still get nailed. Anyway, pretty neat little thing to know about ssh. Not sure that I’ve ever seen this capability on a Win32 platform. Yet another one of the many reasons that I really enjoy Linux.

Have a totally spectacular weekend.

July 31, 2009

Linux: rm -rf * – screenshot of the day

by @ 8:04 am. Filed under command-line, humor

Linux: rm -rf *

 

Tell me you haven’t always wanted to do this.

July 28, 2009

Linux, what nice… passwords you have… and your prompts are incredible…

by @ 6:01 pm. Filed under bash, command-line, General Linux, Linux tips

When you have the level of paranoia that I do, being able to generate ultra-secure passwords is a very nice thing.

My bash prompt is also something I take great pride in. Not only that, I really like it.

Well guess what, folks… you can do both with the same file. This would be your .bashrc file. Here’s a basic look at my prompt:


[1850][scott@laptop:~]$

It shows me the time, the account with which I am logged in, the hostname of the local machine, and the present working directory. All handy things to know.

Now, for the password generation thing, check this out:

[1855][scott@laptop:~]$ genpasswd 64
(#b-p>yi>ojSw@oS6PN,uo_A`;.}DuyfG{levk[Q$UgfrmAkE^t|&)dZb!Nry;
[1855][scott@laptop:~]$

You can make rainbow tables ’til the end of time, and let John the Ripper go on the /etc/shadow file with that password in it, and you ain’t gonna be cracking that password.

If this is interesting to you, or you have other suggestions of a similar nature, please, let’s have ’em.

That all said, here’s the .bashrc file that makes this prompt and password generator possible:

# /etc/skel/.bashrc:                                          
# This file is sourced by all *interactive* bash shells on startup.  This
# file *should generate no output* or it will break the scp and rcp commands.

# colors for ls, etc.
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls -al --color"

# Change the window title of X terminals
case $TERM in
        xterm*|rxvt|Eterm|eterm)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
esac

##uncomment the following to activate bash-completion:
#[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion


function proml {
local       BLUE="\[\033[0;34m\]"
local        RED="\[\033[0;31m\]"
local  LIGHT_RED="\[\033[1;31m\]"
local      WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="${TITLEBAR}\
$BLUE[$RED\$(date +%H%M)$BLUE]\
$BLUE[$LIGHT_RED\u@\h:\w$BLUE]\
$WHITE\$$LIGHT_GRAY "
PS2='> '
PS4='+ '
}

proml

alias ifconfig="/sbin/ifconfig"

genpasswd() {
        local l=$1
        [ "$l" == "" ] && l=20
        tr -dc A-Za-z0-9\-_~\!@#$%^\&*\(\)\\\`\+\[\{\]\}\|\;:\",\<.\>/?\= < /dev/urandom | head -c ${l} | xargs
}

Hope that's as useful for you as it has been for me.

July 21, 2009

Linux command for “What’s up on this here box?”

by @ 8:33 am. Filed under bash, command-line, General Linux, sweet tools

Linux has so many marvelous tools. The great part about this is that you can combine the tools to make new tools. As you may know, there have been previous postings about a tool called ‘sup’ which tells you some useful information about the linux box into which you are logged. Having so many terminal windows open, and screen sessions going, it’s easy to get lost in the labyrinth of connections and sessions. This tool clears all that up for you really quick.

Since the last version, the most significant change is the ability to determine which version of which Linux distribution you are using.

Here is some sample output:

<=== SYSTEM ===>
  Distro info:  Welcome to openSUSE 11.1 - Kernel \r (\l).
  Kernel:       Linux laptop 2.6.27.19-3.2-pae #1 SMP 2009-02-25 15:40:44 +0100 i686 i686 i386 GNU/Linux
  Uptime:        9:20am  up   0:47,  1 user,  load average: 0.64, 0.54, 0.38
  Memory:       Total: 1986Mb   Used: 730Mb     Free: 1256Mb
  Swap:         Total: 4180Mb   Used: 0Mb       Free: 4180Mb
  Architecture: i686
  Processor:    0 : Intel(R) Core(TM) Duo CPU T2250 @ 1.73GHz
  Processor:    1 : Intel(R) Core(TM) Duo CPU T2250 @ 1.73GHz
  Date:         Tue Jul 21 09:20:09 MDT 2009

<=== USER ===>
  User:         scott (uid:1000)
  Groups:       users www
  Working dir:  /home/scott
  Home dir:     /home/scott

<=== NETWORK ===>
  Hostname:     laptop
  IP (lo):      127.0.0.1/8
  IP (lo):      127.0.0.2/8
  IP (eth0):    10.245.106.6/24
  Gateway:      10.245.106.1
  Name Server:  10.45.106.10

 

Download this “Linux ‘sup’?” script here.

July 14, 2009

Securing Linux – A Crash Course in iptables

by @ 6:27 pm. Filed under command-line, General Linux, How-To, security

Once in awhile, it’s nice to block hostile machines on the kernel level. Specifically, this is done with iptables or ipchains. Iptables if you are living in this millenium.

If a specific host is known to be hostile, execute the ‘whois’ command on the ip address. This will give you the IP range of the organization assigned the ip block to which the offending ip belongs. If it is outside of the country and you only service clients inside your country, it doesn’t hurt to block the whole ip range. So, we’re going to block a hostile block from China. As root, run the following command:

iptables -I INPUT -s 125.71.214.0/24 -j DROP

Why not REJECT instead of drop? This adds a rule to the firewall that simply drops the packets. This is more annoying to the other end because they never get a response. If you explicitly reject the packets, they get a message to the effect instantaneously. You want them to have to wait. It slows them down, which is bad for them.

To list the rules in the INPUT chain:

iptables –line-numbers -L INPUT

To delete a rule from the INPUT chain:

iptables -D INPUT [line number]

ex. iptables -D INPUT 1

Would delete the first rule in the INPUT chain.

Cool subnet calculator at : http://www.subnet-calculator.com/

Helpful comments with more useful or better commands welcome.

April 3, 2009

Linux Commands to Create NTFS Filesystem on USB Stick

by @ 9:26 am. Filed under bash, command-line, How-To, Linux tips

First, the stick should be in, but not mounted. If it is mounted, find the partition represented by your usb stick, as such:

[0959][scott@laptop:~]$ mount
/dev/sda2 on / type ext3 (rw,acl,user_xattr)
/proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/sda1 on /windows/C type fuseblk (rw,allow_other,blksize=4096)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /home/scott/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=scott)
/dev/sdc1 on /media/disk-1 type vfat (rw,nosuid,nodev,shortname=winnt,uid=1000)
/dev/sdb1 on /media/disk-2 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=1024)
[0959][scott@laptop:~]$

It will likely be a /dev/sdxx type device. In this case, the one I’m looking for is sdb1.

We need to unmount it as root (‘su’):

laptop:/home/scott # umount /dev/sdb1
laptop:/home/scott #

Now, fdisk the usb stick, and not the partition. In other words, leave off the trailing digit:

laptop:/home/scott # fdisk /dev/sdb

Command (m for help):

Press ‘p’ to view the partitions on the drive. Delete all partitions. Create a new one with ‘n’. It will be a primary partition, and it will be partition 1. Now, we need to set the filesystem type. Press ‘t’, and then if you’d like to see all the filesystem types, press ‘L’, but I’ll just tell you that NTFS is 7. Press ‘7’, and then ‘w’ to write the partition table, and exit:

Command (m for help): p

Disk /dev/sdb: 1027 MB, 1027604480 bytes
64 heads, 32 sectors/track, 980 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x610fbfb2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         980     1003504    c  W95 FAT32 (LBA)

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-980, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-980, default 980):
Using default value 980

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
laptop:/home/scott #

Now, we need to actually format the new partition. Include the partition number at the end. It should be 1. You will do this as root (‘su’), like so:

laptop:/home/scott # mkntfs /dev/sdb1
Cluster size has been automatically set to 1024 bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
laptop:/home/scott #

K, well, there you are. Mount it up any way you see fit, and you are all set.

June 12, 2008

How many ways can you install an RPM in OpenSUSE Linux?

by @ 7:02 am. Filed under command-line, How-To, SUSE Tips & Tricks
Introduction

Package management in OpenSUSE in recent years has had its share of challenges. In OpenSUSE 10.1, the package management was an epic trainwreck. Package management in OpenSUSE 10.3 is as good as that was bad. There are various types of speed improvements. Some of them huge. There is some caching of the repository package info. Progress bars so the user knows what’s going on. All sorts of goodness.

But I wanted to see how many ways I could install a package on OpenSUSE 10.3 (and 11.0, for that matter) without any help from any third-party package management tools that don’t come stock on a fresh OpenSUSE install. Like no apt, yum, smart, etc. Just using the package management tools that come on the fresh install, how many ways can one install a package? There’s a method to this madness, too. You never know under what circumstances you’ll have what access to the machine you’re working on, especially if it is remote. One of the mantras of Linux pros is that there is four billion ways to skin a cat. OK, so I made that up. It’s good to know many ways of doing the same thing, though.

Especially if we want to automate something. If we do it one way, maybe it requires human interaction. If we do it a different way, no human interaction is required, and thus, we can automate that process.

OK, without any more excessive yammer, let’s take a look, shall we?

RPM Installation Methods

1. Use YAST – Let’s get the obvious one out of the way. Click on the YAST icon, put in your root password. In the window that appears, select SOFTWARE from the left, and SOFTWARE MANAGEMENT on the right. At some point, the YAST Package Management window appears. Search for the desired package, click ACCEPT. Approve any additional necessary packages. YAST installs everything, and asks if you want to install or remove more packages. Say no, and you’re done.

This is the classic way to install packages in OpenSUSE using YAST. One benefit is that it does a good job of resolving dependencies for you. One possible drawback is that it reauires all kinds of human interaction. So there’s our first way.

2. Use zypper – This is a powerful command-line tool used in OpenSUSE much in the same way we might use something like apt-get. To see all the ways you can use this tool, run zypper –help from a command line:

[2318][root@linux:/]$ zypper --help
  Options:
        --help, -h              Help.
        --version, -V           Output the version number.
        --quiet, -q             Suppress normal output, print only error messages.
        --verbose, -v           Increase verbosity.
        --terse, -t             Terse output for machine consumption.
        --table-style, -s       Table style (integer).
        --rug-compatible, -r    Turn on rug compatibility.
        --non-interactive, -n   Don't ask anything, use default answers automatically.
        --no-gpg-checks         Ignore GPG check failures and continue.
        --root, -R <dir>        Operate on a different root directory.

  Commands:
        help, ?                 Help
        shell, sh               Accept multiple commands at once
        install, in             Install packages or resolvables
        remove, rm              Remove packages or resolvables
        search, se              Search for packages matching a pattern
        repos, lr               List all defined repositories.
        addrepo, ar             Add a new repository
        removerepo, rr          Remove specified repository
        renamerepo, nr          Rename specified repository
        modifyrepo, mr          Modify specified repository
        refresh, ref            Refresh all repositories
        patch-check, pchk       Check for patches
        patches, pch            List patches
        list-updates, lu        List updates
        xml-updates, xu         List updates and patches in xml format
        update, up              Update installed resolvables with newer versions.
        info, if                Show full information for packages
        patch-info              Show full information for patches
        source-install, si      Install a source package
[2319][root@linux:/]$

To install a package from the command line using zypper, you’ll do that this way:

[2321][root@linux:/]$ zypper install bzflag
* Reading repository 'openSUSE-10.3-Updates' cache
* Reading repository 'openSUSE-10.3-OSS-KDE 10.3' cache
* Reading repository 'Jpackage' cache
* Reading repository 'Main Repository (NON-OSS)' cache
* Reading repository 'Eric Lavar - Germany' cache
* Reading repository 'Main Repository (OSS)' cache
* Reading installed packages [100%]


The following NEW package is going to be installed:
  bzflag

Overall download size: 10.8 M. After the operation, additional 15.0 M will be used.
Continue? [yes/no]: yes
Downloading package bzflag-2.0.8-78.x86_64, 10.8 M (15.0 M unpacked)
Downloading: media
* Downloading [100%]
Downloading: bzflag-2.0.8-78.x86_64.rpm
* Downloading [100%]
* Installing: bzflag-2.0.8-78 [100%]
[2323][root@linux:/]$

It resolves all dependencies, and installs everything it needs. Great way to do things without so much human interaction. There are even flags that will allow us to omit human interaction entirely (–non-interactive and –no-gpg-checks). Very nice.

3. Use the rpm command – Every once in awhile, there is a package that YAST cannot find in the available repositories. When this happens, I head over to one of three places: rpmseek.com, Rpmfind, or pbone.net. In almost every case, I can find an RPM that was built for whatever version of OpenSUSE that I am using on that particular box. I just download the RPM in question, and install it with the rpm command. Many people suggest doing this in the following manner:

[2215][scott@linux:~]$ rpm -Uvh [full path to RPM here]

This is one of the possibly more difficult ways to install an RPM. Not because it’s a difficult command, but because it doesn’t resolve dependencies. If there are dependencies, you get to resolve those babies yourself. It’s possible, but I would definitely prefer a poke in the eye with a sharp stick.

4. 1-Click Install – Tell you what, one of the coolest things that OpenSUSE has come up with thus far is the 1-Click Install. At first, I thought it was an April Fool’s Joke. But realizing it wasn’t April, I decided to give it a try. To see how cool this is, head over to the OpenSUSE Build Service. Search for a package like kopete. Scroll through the results. When you find the one you want to install, click on the “1-Click Install” button off to the right side. You’ll have to verify some things and provide your root password, but other than that, it is virtually hands-off installation of the package. Hands-down easiest way to install packages in OpenSUSE.

5. Install with YAST from custom installation repository – Sometimes, you will have an rpm that you want installed, but cannot find it in YAST. You can download it and try to install it with rpm. The problem is that it has 12 dependencies. What then? Switch distributions to something more sensible? No way, we’ll just take the easy way out. Create our own repository and point YAST to that. This process is very simple.

Install the createrepo package. Then, create a directory to be used as the repository. Dump the RPM in there. Then, run the createrepo command on that directory. For example, make a directory called /my_inst_src. Throw your RPM (as hard as you can) into that folder. Then, create the repository with this command:

[2246][root@linux:/home/scott]$ createrepo /my_inst_src
1/1 - pidgin-2.4.2-5.1.i586.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[2247][root@linux:/home/scott]$

Then, just add that directory as an installation source in YAST=>SOFTWARE=>SOFTWARE REPOSITORIES.

Finally, go into YAST=>SOFTWARE=>SOFTWARE MANAGEMENT and search for the RPM you placed into your new repository. You should be able to find and install it easily. The great part here is that YAST should be able to resolve the package dependencies.

Yes, there are a few steps involved here. However, you can take this concept and apply it to an entire network of desktop or server machines. Pick a repository server on your network and create your own repository on it. Then, export that repo via NFS to the rest of the network. Next, just add that repository to the other machines on the network. The great part is that you only have to add the repository to each of the other machines once. But then, instant access to install that package on any of those boxes. This particular solution has been very helpful for me on several occasions.

6. Install with zypper from custom installation repository – Same thing as the previous method. We download a stand-alone RPM that has many dependencies. So the approach will be similar. Install createrepo, make a repository directory, and put your RPM in there. Use createrepo to build your repository as demonstrated above.

Then, instead of YAST, go ahead and add your new repository using the zypper command, like so:

[2308][root@linux:/home/scott]$ zypper addrepo /my_inst_src "My Installation Source"
* Adding repository 'My Installation Source'
Repository 'My Installation Source' successfully added:
Enabled: Yes
Autorefresh: Yes
URL: dir:///my_inst_src
[2309][root@linux:/home/scott]$

Make sure it was installed properly, again using zypper:

[2258][root@linux:/home/scott]$ zypper repos
# | Enabled | Refresh | Type   | Alias                                                             | Name
--+---------+---------+--------+-------------------------------------------------------------------+-----------------------------------------------------------
1 | Yes     | Yes     | rpm-md | openSUSE-10.3-Updates                                             | openSUSE-10.3-Updates
2 | Yes     | No      | yast2  | openSUSE-10.3-OSS-KDE 10.3                                        | openSUSE-10.3-OSS-KDE 10.3
3 | No      | Yes     | NONE   | http://download.opensuse.org/distribution/10.3/repo/debug/        | http://download.opensuse.org/distribution/10.3/repo/debug/
4 | Yes     | Yes     | rpm-md | Jpackage                                                          | Jpackage
5 | Yes     | Yes     | yast2  | http://download.opensuse.org/distribution/10.3/repo/non-oss/      | Main Repository (NON-OSS)
6 | Yes     | Yes     | rpm-md | Eric_Lavar_-_Germany                                              | Eric Lavar - Germany
7 | Yes     | Yes     | rpm-md  | My Installation Source                                            | My Installation Source
8 | Yes     | Yes     | yast2  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | Main Repository (OSS)
[2259][root@linux:/home/scott]$

There it is, highlighted in red. Rock on, now we can make sure zypper finds our new package, thusly:

[2309][root@linux:/home/scott]$ zypper search pidgin
Refreshing 'My Installation Source'
repomd.xml is unsigned, continue? [yes/no]: yes
* Building repository 'My Installation Source' cache
* Reading installed packages [100%]

S | Repository                                                        | Type    | Name                   | Version    | Arch
--+-------------------------------------------------------------------+---------+------------------------+------------+-------
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin                 | 2.1.1-13   | i586
i | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin                 | 2.1.1-13   | x86_64
v | My Installation Source                                            | package | pidgin                 | 2.4.2-10.1 | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry      | 1.1.0-45   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry      | 1.1.0-45   | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry-lang | 1.1.0-45   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry-lang | 1.1.0-45   | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-devel           | 2.1.1-13   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-devel           | 2.1.1-13   | x86_64
[2309][root@linux:/home/scott]$ 

The one we’re looking for is highlighted in red. Looks like we’re ready to go ahead and install the application:

[2313][root@linux:/home/scott]$ zypper in pidgin

If the package is so brand-new that it has dependencies that are unresolvable, obviously you’ll have problems. But for many common packages, this method works great.

As a side note, you can also set your machines up so that you don’t even need the discs to install packages. Put the DVD ISO on your machine and you can put that into YAST as an installation source. Disable the source that uses the local optical drive. Then, it will pull packages from the ISO.

Even better, you can put that DVD ISO on a server on your network. Mount it on that server, and export the mount point via NFS to the rest of the network. Go to each machine in the network. Disable the source that uses the local optical drive. Add the NFS share from the server as an installation source on each box. Then, the machines on the network will pull packages from the NFS share.

Conclusion

There are at least a handful of ways to get installed what you need installed on your box. Depending on whether you are a home user with one computer or a Linux system administrator with 100 servers, or anything in between, you’re bound to use one or more of these methods. And these methods work on both OpenSUSE 10.3 and 11.0. Have a lot of fun…

March 18, 2008

ssh Without a Password

by @ 9:09 am. Filed under bash, command-line, Linux tips, ssh tips

If you use Linux for day-to-day computing, you likely use the secure shell, or ssh. If you are like me, you may grow weary of constantly having to type in passwords to access remote machines. Or maybe you have the perfect backup system, except that it uses ssh to transfer files, and requires you to type in a password (such as rsync or rdiff-backup). There is a way to access those machines without using a password. This technique should be used with care. I’d use it only on machines that I have access to, for example. You don’t want to set up passwordless access from a public machine to your production server, in other words. Use with caution.

The principle is that you generate a public and private key on the local machine. This will be whatever machine you are connecting from. You then transfer the public key to the remote machine. Then, when you ssh into the remote machine, it uses the keys to authenticate. You don’t type in a password, it just takes you straight to the shell prompt. How do we set this up?

Log into the machine you are going to connect from. Let’s say that your account is called ‘user’ and you are going to connect from a machine called ‘desktop’. Log in as ‘user’ on the ‘desktop’ machine and pull up a shell. Run this command. The stuff in red is what you do,not what you type:

[0218][user@desktop:~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa): [JUST PRESS ENTER HERE]
Enter passphrase (empty for no passphrase): [JUST PRESS ENTER HERE]
Enter same passphrase again: [JUST PRESS ENTER HERE]
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
a5:25:c0:aa:fe:f3:9f:46:7a:23:e3:6e:10:ec:6f:d3 user@desktop
[0218][user@desktop:~]$

Your keys are generated. On that machine, view /home/user/.ssh/id_dsa.pub. You will see something like this:

ssh-dss AAAAA3NzAC1kc3MAAACAANfnr9xkAks2u8Xd5I9nozzsXLKCYA8o9h3cMwL5QMcZGxz84Dyl3IyRwozv3I2xGwJAYyAHvJAS7AQmtFXtfmQts3dt2ZnlAmKj0TkC8pwDgvXJYzARJpCP2Zx7iwD/OCO3sTgT0wGwYtQrAcTeW5Tt6sSmQjEJ2rJj+Q5XA1xvAAAAFQDWcQ+OJRnk+jCYqESWqxHcyw74DwAAAIA9qAQyZrOJkjpzMSWAcliHvvuyCN8RInlgq+IwWynukOX7zYXcE2dJPopgpG3Aiiq/fxAQX5dUzXfSrL3KYftQOd/RNkAzMHAAzAJeQAA0wEt4uAjhGRwCOSg6wKMYJPYfVghnwIKARuSTUS8NjRXVKteHg7frOOHZwRGIm36pxgAAAIA8/CKLLn5QRctsvvvmvpOn2Xhek02z8K0YukYcXJOQ1FMTYWoHujA39sEAFsdx6Nq1t58lI2dsj6fpf7LOOvoYWtKQnTNRUptlOx27LTO9Q6DhKPV/93nLI/xFOFo/8twZ1TmpAgpAI3SQ9YCnX2A8H686OUwUPmY0kA+H8GKnug== user@desktop

What you need to do now, is determine the remote machine you are going to log into. Then, decide what user you are going to log in as on that machine. We are going to log in as a user called ‘admin’ on a server called ‘server’. First, we will ssh into ‘server’ as ‘admin’. Then, edit the file located at ~/.ssh/authorized_keys2. If it is not there, create it. All you need to do is paste the contents of the id_dsa.pub file from the ‘user’ account on the ‘desktop’ machine into the ~/.ssh/authorized_keys file for ‘admin’ on ‘server’.

For example:

I go to my desktop, log in as ‘user’. I run ‘ssh-keygen -t dsa’. It generates a ~/.ssh/id_dsa.pub file in my home directory.

I want to connect as ‘admin’ on a box called ‘server’. I ssh in normally as ‘admin’ into the ‘server’ machine. I edit the ~/.ssh/authorized_keys2 using my favorite text editor. I add the contents of the ~/.ssh/id_dsa.pub file from my desktop machine into the authorized_keys2 file on ‘server’. I then save and quit. I then close all connections to ‘server’. Then, I type ‘ssh admin@server’, and hit ENTER. It drops me straight to a shell prompt.

This is a nice way to access a machine without having to type in the password every time. Only do this from machines that only you or authorized personnel have access to. Otherwise, you could have a li’l security problem.

March 17, 2008

Basic Packages Missing in Text-Only Install

by @ 12:23 pm. Filed under command-line, General SUSE, SUSE releases

Basic system packages are missing in the text-only install (and minimal graphic install) of OpenSUSE 10.3, from what I can tell. I installed a machine using the minimal graphical install. When finished, I found that basic packages like ‘man’ and ‘ping’ and ‘vim’ and some other basic commands were missing. The ‘crontab’ was missing, for the love of all that is holy.

Searching around, I found advice on how to install the missing packages, which is useless, because I’m already slightly familiar with package installation with YAST. What I would like to find is a plausable explanation for why such basic packages are missing from the text-only install. ESPECIALLY when such packages were installed in the text-only installs of previous versions of OpenSUSE.

Seriously, this is one of those “slap me in the face with a 2×4” duh types of things. Why on the face of this planet would they make such a decision? If there is a good explanation, I am dying to know the answer. Anyone with some insight is more than welcome to share their thoughts.

Anyone wanna help me out here?

March 14, 2008

Funny Linux Commands (with actual output)

by @ 6:39 am. Filed under command-line, General Linux, humor

OK, so who hasn’t seen this? Nonetheless, it’s still worth revisiting:

Funny Linux command-lines with real output…

% cat “food in cans”
cat: can’t open food in cans

% nice man woman
No manual entry for woman.

% “How would you rate Quayle’s incompetence?
Unmatched “.

% Unmatched “.
Unmatched “.

% [Where is Jimmy Hoffa?
Missing ].

% ^How did the sex change operation go?^
Modifier failed.

% If I had a ( for every $ the Congress spent, what would I have?
Too many (‘s.

% make love
Make: Don’t know how to make love. Stop.

% sleep with me
bad character

% got a light?
No match.

% man: why did you get a divorce?
man:: Too many arguments.

% !:say, what is saccharine?
Bad substitute.

% %blow
%blow: No such job.

% \(-
(-: Command not found.

$ PATH=pretending! /usr/ucb/which sense
no sense in pretending!

$ drink matter
matter: cannot create

Great stuff, tell you what.

February 4, 2008

Viewing all the gory details of an RPM

by @ 6:59 am. Filed under command-line, General Linux, Linux tips

RPM Icon

Linux has a varied methodology of managing packages. RPMs are one of the most common. Some distros have source-based package management systems, such as Portage for Gentoo. Derivatives of Debian such as Ubuntu have packages in DEB format.

For the RPM-based distributions, the package manager tries to take care of resolving dependencies for you. Some of them do a great job at this. At some point, however, you’ll likely have to work directly with an RPM package on the command-line.

One thing I really like about YAST (and others) is that you can browse and search through the description, and view other package details. You can see the author, version, vendor, build date, build host, size, etc. You can also see a list of what files will be installed, and where they will be placed.

So how do we view all that info from the command line?

This is fully possible by using the rpm command. Let’s say we are going to install vsftpd from an RPM from the command line. Using the rpm command, we add a few switches to display the information:

rpm -qpil vsftpd-2.0.5-78.x86_64.rpm

The ‘q’ is for ‘query’. The ‘p’ refers to querying a package file. ‘i’ means, “Display package information, including name, version, and description.” The ‘l’ tells the rpm command to list all the files in the package.

Output of this command would look something like the following:

[1116][scott@tomahawk:~/64-bit software/vsftpd]$ rpm -qpil vsftpd-2.0.5-78.x86_64.rpm
Name        : vsftpd                       Relocations: (not relocatable)
Version     : 2.0.5                             Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release     : 78                            Build Date: Fri 21 Sep 2007 02:34:57 PM MDT
Install Date: (not installed)               Build Host: glinka.suse.de
Group       : Productivity/Networking/Ftp/Servers   Source RPM: vsftpd-2.0.5-78.src.rpm
Size        : 286006                           License: GPL v2 or later
Signature   : DSA/SHA1, Fri 21 Sep 2007 02:43:56 PM MDT, Key ID a84edae89c800aca
Packager    : http://bugs.opensuse.org
URL         : http://vsftpd.beasts.org
Summary     : Very Secure FTP Daemon - Written from Scratch
Description :
Vsftpd is an FTP server, or dæmon. The "vs" stands for Very Secure.
Obviously this is not a guarantee, but the entire codebase was written
with security in mind, and carefully designed to be resilient to
attack.

Recent evidence suggests that vsftpd is also extremely fast (and this
is before any explicit performance tuning!). In tests against wu-ftpd,
vsftpd was always faster, supporting over twice as many users in some
tests.



Authors:
--------
    Chris Evans 
Distribution: openSUSE 10.3 (X86-64)
/etc/init.d/vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/sysconfig/SuSEfirewall2.d/services/vsftpd
/etc/vsftpd.conf
/etc/xinetd.d/vsftpd
/usr/sbin/rcvsftpd
/usr/sbin/vsftpd
/usr/share/doc/packages/vsftpd
/usr/share/doc/packages/vsftpd/AUDIT
/usr/share/doc/packages/vsftpd/BUGS
/usr/share/doc/packages/vsftpd/COPYING
/usr/share/doc/packages/vsftpd/Changelog
/usr/share/doc/packages/vsftpd/EXAMPLE
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/packages/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/packages/vsftpd/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/packages/vsftpd/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/packages/vsftpd/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/packages/vsftpd/EXAMPLE/README
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/packages/vsftpd/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/packages/vsftpd/FAQ
/usr/share/doc/packages/vsftpd/INSTALL
/usr/share/doc/packages/vsftpd/LICENSE
/usr/share/doc/packages/vsftpd/README
/usr/share/doc/packages/vsftpd/README.SUSE
/usr/share/doc/packages/vsftpd/README.security
/usr/share/doc/packages/vsftpd/REWARD
/usr/share/doc/packages/vsftpd/SECURITY
/usr/share/doc/packages/vsftpd/SECURITY/DESIGN
/usr/share/doc/packages/vsftpd/SECURITY/IMPLEMENTATION
/usr/share/doc/packages/vsftpd/SECURITY/OVERVIEW
/usr/share/doc/packages/vsftpd/SECURITY/TRUST
/usr/share/doc/packages/vsftpd/SIZE
/usr/share/doc/packages/vsftpd/SPEED
/usr/share/doc/packages/vsftpd/TODO
/usr/share/doc/packages/vsftpd/TUNING
/usr/share/empty
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/usr/share/omc
/usr/share/omc/svcinfo.d
/usr/share/omc/svcinfo.d/vsftpd.xml
[1116][scott@tomahawk:~/64-bit software/vsftpd]$

Now, we can see where the binaries will be installed. We can see where the config file will be. We can see where the docs and man pages will be placed.

If you need to install an RPM from the command line, normally, you could issue a command such as:

rpm -i [packagename]

A better way to do this may be as follows:

rpm -Uvh [packagename]

The “U” means upgrade. In cases where you have an older version of an RPM installed, and you’re trying to install a newer version, the -i will not do this. You’d first have to erase the RPM with the -e switch. However, if you have dependencies that rely on that RPM, you won’t be able to erase the old version of the RPM unless you want to get even more hairy. It’s easier to just tell it to upgrade. In cases where you do not have an older version of the RPM installed, the command will still install the intended RPM.

The “v” is for verbose. This just provides more information about the installation process of the RPM.

The “h” option is for “show hashes.”

The problem here is that it doesn’t automatically install dependencies.

The other thing is that you can create your own installation repository (super easy) with createrepo. Install the createrepo package. Then, you create a directory which you will use as the repository, such as /my_inst_src. Dump the RPM in there. Then, you run the createrepo command, pointing it to the new repository:

createrepo /my_inst_src

You then go into YAST and add /my_inst_src as an installation source.

You should now be able to go into YAST and install it just like you do any other RPM. Dependencies should be resolved as usual, should any exist.

If you are interested in package management through YAST, there is just such an ebook available from suseblog.com. In the upper left corner, there is a place to grab some ebooks. One of them is called “YAST – Installation and Management of Software.” Take a look at that and see if it’s helpful for you.

January 25, 2008

Linux commands for “What is taking up all my space?”

by @ 6:49 am. Filed under bash, command-line, General Linux, How-To, Linux tips

Terminal Icon

When you’re in the trenches, pounding out solutions, it’s nice to have any added advantage that you can. Finding the source of what is taking up all the space on a given Linux partition may just find itself on your priority list some day. And when you need to know right now where it is, it’s great to have the following solutions.

Should you need to find the source of what is taking up the space on one of your Linux boxen, you can use this command to get you through:

stage:/ # du -s * | sort -g
0       proc
0       sys
4       media
4       mnt
16      lost+found
68      tmp
100     srv
112     dev
2564    home
7568    bin
9280    sbin
9916    boot
28528   etc
70844   lib
209624  var
221708  root
429396  opt
1848788 VM
2686844 usr
stage:/ # 

So now obviously, my /usr path is taking up the most space. Let’s head into /usr and run the command again:

stage:/ # cd usr
stage:/usr # du -s * | sort -g
0       tmp
12      X11R6
16      i586-suse-linux
76      local
3404    games
12124   include
18100   sbin
100424  bin
331616  src
1103240 share
1117832 lib
stage:/usr # 

We then see that /var/lib and /var/share are taking up the most space.

Once you find the culprits, you can archive them, back them up, truncate them, or just plain rm them (please use ‘rm’ with care).

Also, if you are looking for all files on your drive larger than a certain size, the following script may be useful to you. Don’t forget to ‘chmod +x’ it to make it executable:

#!/bin/sh

# In kilobytes on older machines
MINSIZE=1000

IFS=$'\\n'

# Find the files and put them in a list
FILELIST=`find . -size +"$MINSIZE"k -print`

for FILE in $FILELIST ; do

        FILESIZE=`stat \-\-format=%s "$FILE"`
        FILEM=$(echo "scale=2;$FILESIZE/1048576" | bc -l)
        printf ""$FILE"\\n"
        printf "\\tsize is "$FILEM" Megabytes\\t"
        printf "\\ttype is `file -b "$FILE"`\\n\\n"

done


You may ask, “What is this IFS thing?” Well, it is explained quite well on tldp.org. But for those of us who don’t want to go read that, I’ll just copy and paste the important part for ya’ll:

internal field separator

This variable determines how Bash recognizes fields, or word boundaries, when it interprets character strings.

In other words, bash by default uses spaces to separate things into lists. You are telling it to split the list of files up by the \n or carriage return character rather than by spaces.

Anyway, use the command demonstrated above, and the bash script demonstrated below, to find the files that are taking up all your space.

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

August 2018
S M T W T F S
« Feb    
 1234
567891011
12131415161718
19202122232425
262728293031  

78 queries. 1.885 seconds