Archive for the 'debian' Category

Sort CLI output by line length

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

Want to sort file contents by each line’s lenght? No problems:

artemn@artemn-laptop:~$ cat /etc/passwd | awk '{print length, $0}' | sort -n | awk '{$1=""; print $0 }'

Continue reading…

Mount remote filesystem via ssh protocol using sshfs and fuse [Fedora/RedHat/Debian/Ubuntu way]

sshfs

Imagine the following situation: you have to compile some Linux/Unix application or kernel module that requires kernel source present at your hard drive, say, in /usr/src/kernels/kernel-2.6.21-i386/ or elsewhere. But there is not enough disk space to copy these sources or install kernel-devel or linux-source packages (in Fedora/RedHat or Ubuntu/Debian distros respectively)… Sounds familiar? Believe me, sometimes it happens :)

As a solution you can mount the directory of some remote PC that contains needed kernel source. It can be done via several protocols like smb, ftp etc. In this article we will mount remote directory using ssh protocol that is one the most popular for remote and secure access to Linux boxes over the network.

Below are the steps which should be taken to get the ball rolling. We need two packages: sshfs and fuse-utils.

ssh1. Install necessary packages:

a. Ubuntu/Debian:

sudo aptitude install fuse-utils sshfs

b. Fedora/Centos/RedHat:

yum install fuse-sshfs fuse fuse-libs

c. Other Linux: download and compile sshfs/fuse from sources

2. Check that kernel module fuse is loaded:

lsmod | grep fuse

There should be the line containing “fuse” in the output (of not try modprobe fuse).

3. Mount remote filesystem using something like this (two commands):

mkdir -p /mnt/sshfs/
sshfs remote-user@remote-machine:/some/directory /mnt/sshfs

where remote-user is the username allowed to login remote-machine via ssh protocol. It will ask you to type the password so just type it and press return :)

4. That’s it. Good luck!

Open .docx documents in Linux (OpenOffice)

Well, as for now it is not a problem anymore to open Microsoft Office 2007 .docx documents in any Linux distribution coming with OpenOffice suit. It may be Ubuntu (Feisty, Gutsy, Interpid whatever), almost any version of Fedora/RedHat/Centos, *SUSE, Mandriva and of course Debian (as per my personal opinion it’s the best one).

What is .docx actually? It’s Microsoft’s file format representing word processor documents and named OpenXML (as an attempt to create open and free international standard). Today .docx is default format for Microsoft’s word processor Word.

There are myriads of online converters between OpenXML and OpenOffice formats including .docx, .xlsx, .odt and many etc but sometimes it’s much more better to just open received .docx file in Linux offline (if there is temporarily no Internet connection or for security/private reasons etc).

So, just download the following package to certain directory like /usr/src, here are the commands to do it:

1. cd /usr/src
2. sudo wget http://blog.mypapit.net/imej/odf_filter.tar.bz2

The next step is to unpack the contents of the archive (.tar.bz2 is definitely well compressed file) and copy 3 files to OpenOffice’s system directories:

3. sudo tar -xvjf odf_filter.tar.bz2
4. sudo cp OdfConverter /usr/lib/openoffice/program/

5. sudo cp MOOXTypeDetection.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Types/
6. sudo cp MOOXFilter_cpp.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Filter/

As you can see from picture below now it’s possible to natively open .docx files in openoffice under Linux. Of course such “native” support may imply some artefacts in opened files due to file formats incompatibility so it’s also a good option to ask your friends to convert .docs into .pdf before sending you :)

openoffice openxml .docx

P.S. Thanks to guys from mypapit.

P.S. Here are several online converters .doc(x) <-> .odf <-> .pdf:

1. ZAMZAR (possibly the best converter), 2. http://docx-converter.com/.

FAQ: How to change Duplex and/or Auto-Negotiation NIC settings in Linux?

Q: How to disable auto-negotiation option of my network interface card and set up half/full duplex mode manually from Linux command line (CLI)? By the way, how to see current settings?
A: There are several Linux utilities coming with almost any distribution including Debian, Ubuntu, Fedora, RedHat, Mandriva, Centos whatever. See details below.

ethtool

This is rather powerful utility can display and change settings of ethernet network interface card. You can easily disable/enable autonegotiation option for your NIC, also it’s possible to manually set up duplex mode, configure wake-on-lan options, set speed settings. Just look through full manual page for ethtool. Here are several ethtool usage examples:

ethtool eth0 - shows current NIC settings

Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: No
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: pumbg
        Wake-on: d
        Current message level: 0x00000007 (7)
        Link detected: yes

ethtool -s eth0 duplex half autoneg off - disables auto-negotiation, enables Half Duplex.
ethtool -s eth1 duplex full speed 1000 autoneg off - disables auto-negotiation, enables Falf Duplex and sets up Speed to 1000 Mb/s.

mii-tool

According to manual it allows to manipulate and see media-independent interface status. Let’s see examples:

bash-3.1# mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok
- shows 100 Mbps speed, Full Duplex, Auto-negotiation is on.
bash-3.1# mii-tool eth0 -F 10baseT-HD - enables 10 Mb/s Half Duplex connection.

Try Google Chrome in Linux

There is still no native Linux support of newly unveiled browser Google Chrome but guys from CodeWeavers prepared the port of Chromium (official name of Google Chome for Linux). This staff is already available for downloading as DEB packages for Ubuntu (32-bit and 64-bit), as RPM for RedHat, Fedora, CentOS etc. as well as self installable script for any other Linux distribution.

Well, after quick testings there are no doubts that it is not a good option if you wish to have quick and stable alternative for Firefox… But of course it is good for evaluation purposes or for those people who CAN’T wait for official release of Chrome for Linux :) Certainly the port is based on Windows copy run by Wine (don’t forget to upgrade it). Actually CodeWeavers says that this is just a proof of concept, for fun, and to showcase what Wine can do.




Information Improvisation: Operating system is the backbone for every organization. Having professionals with CISSP certification in organization ensures the life running through its networks. Organizations manage tremendous amounts of traffic due to the use of pc phone and people with 646-058 certifications are ideal for this job. They can also manage online networks which can be hosted on lunarpages, which also provides free email hosting. With the company's logo design every page and a well crafted web template the site can be given a graceful look.

 

Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››