Subscribe RSS

Tag-Archive for "console"

File management Jun 24
vifm

vifm

If your like me use linux without a desktop enviroment you’ll probably agree that occasionally when moving about large numbers of files it can get really friggin tedious typing lots of paths. So what about a console file manager great i hear you cry? how about it was based around vim key commands even better.

I Have found such software while doing some searches the other nite it is called vifm and tries to have shortcuts that are as vim like as possible

http://vifm.sourceforge.net

Here’s a mirror of the cheatsheet from the website.

Basic Movement

j – moves down.
k – moves up.
l – moves into a directory or launches a file.
h – moves up one directory.

gg – move to the top of the file list.
G – move to the bottom of the file list.
14G – move to the 14th file in the list.

Ctrl-F or Page Down – move forward one page.
Ctrl-B or Page Up – move back one page.

25% – move to the file that is 25 percent from the top of the list.

:34[Enter] – move to the 34th file.
:0[Enter] – move to the top of the list.
:$[Enter] – move to the bottom of the list.

The Space Bar or Tab Key toggles between the two file lists.

Ctrl+G creates a window showing detailed information about the current file.

Marks

Marks are set the same way as they are in vi.
m[a-z][A-Z][0-9] to set a mark for the current file.
‘[a-z][A-Z][0-9] moves to the file set for the mark.

Searching

/regular expression pattern[Return] – will highlight all files matching the pattern.
N – find the previous match.
n – find the next match.

Additional Normal Mode Keys

[count]dd – moves the selected files to the trash directory.
[count]yy – yanks the selected files.
p – puts the last yanked or deleted files.
t – tag the current file.
v – start visual mode.

Commands

:com – gives a menu of user commands.
:com name action – sets a new user command.
:delc command_name – will remove the command_name user command
:fil regular_expression pattern – will filter all the files out of the directory listing that match the regular expression.
:fil \.o$ – would filter all files ending in .o from the filelist. :empty will permanently remove ‘rm -fr’ files from the Trash directory.
:sh – will start a shell.
:q or :x will exit vifm.
:! program will execute the program in a shell
:!! program is the same as :! but will pause the screen before returning to vifm.
:!! will execute the last command.
:e load file into vi
:pwd show the present working directory.
:cd change directory.
:cd ~/bin
:s[ort] creates a popup menu of different sorting methods.
:his[tory] creates a popup menu of directories visited.
:h[elp] show the help file.
:marks create a popup menu of bookmarks.
:screen toggles whether or not to use the screen program.
:split splits the window to show both file directories
:only changes the window to show only the current file directory

File Filters

The basic vim folding key bindings are used for filtering files.
zO Show the filtered files.
zM Filter the files matching the filename filter.
zo Show all of the dot files.
zm Filter all of the dot files.
zf Filter all of the selected files.

Category: Linux  | Tags: , ,  | Leave a Comment
Linux Panic Button May 09

Have you ever been doing some administration and *poof* everything has frozen nothing works the only thing left to do is restart the system right?

wrong!

There is a lesser known panic button built in to the kernel that will gracefully restart everything by stopping daemons and dismounting drives.

To do this you must hold alt+SysReq (PrintScreen) and type “REISUB” (busier backwards) you may or may not get kernel messages printed to the screen if you dont after finishing typing the system  will gracefully restart.

This is made possible by a feature of the linux kernel that some perople refer to as the “magical sysreq commands”. More information on this can be found Here.

Category: Useful tidbits  | Tags: , ,  | Leave a Comment
Nice, Renice and niceness Apr 01

One of the major benifits of linux is the way memory and processes are organised in such a way that it can be considered one of the best multi threaded operatioing systems available. Regardless of how well something can be scheduled the OS still only have a finate amount of resources to work with. My little nugget of joy today is a short description and usage by example of the nice and renice commands.

I want to write this article as i find the man pages for these commands incredibly confusing.

Niceness (as it is commonly known) is the priority that a particular task has from the perspective of the process scheduler in the kernel (i use “the” kernel as it is a common feature of most *nix like os’es)

Niceness is best imagined as a queue that ranges from -20 to 19

nice_diagram

As you can see from the little diagram, the lower the number the higher the priority.

Most userspace applications will start with a niceness of 0 which is the most favoured niceness that a non-root user can have. Running ps wauxfl you will see the niceness of an application along with some other information such as username and a tree view of processes.

There are two ways to start a process with a different nice level. The first is at program initial execution using the nice command.

nice -4 <command>

This command will start a process with a slightly lowered niceness of 4 (less favoured) and can be run as a a normal user.

nice --4 <command>

This command has to be run as a super user. Notice the double dash (- -) this identifies that it is a switch and will have a niceness of -4 slightly raising the priority of an application above that of non root applications.

The other option for modifying the niceness of an application is renice. This tool is ported from BSD systems and as such the syntax is slightly different. Renice will let you cnange the niceness of an application that is already running.

renice +4 <pid>

This example of renice will set the niceness of <pid> to 4 lowering it’s niceness.

renice -4 <pid>

Running the command as a super user is necessary to set the niceness to less than 0 just like nice. The niceness is set to -4 in this example.

So why would you want to know about this? I personally like nice and renice as it allows you to run long and potentially resource hungry applications without stealing cpu cycles from those applications that need them. I like using nice to assist me run backups during the day or if i need something done quickly.

Linux terminal tty resolution Mar 27

babe_wayhayWith a lot of linux distributions the default tty resolution will work with almost all old hardware. You may have noticed that this compatible (default) resolution is klunky and not particularly useful when trying to view large amounts of data. It is infact possible to change the resolution to anything as high as 1280×1024. This is a feature of the linux kernel that can be set at boot time. First look at the table below

Colour Depth 640×480 800×600 1024×768 1280×1024
8 (256) 769 771 773 775
15 (32k) 784 787 790 793
16 (65k) 785 788 791 794
24 (16M) 786 789 792 795

This table enables you to choose your tty resolution and colour depth and you are left with a number e.g. 1024×768 16bit = 791.

This number now needs to be put in to the line of your bootloader where the kernel is loaded. (/boot/grub/menu.lst) I have only ever used grub but im sure it will work with lilo and other boot loaders.

Look for the line like:
kernel       /boot/vmlinuz-2.6.26-1-amd64 root=/dev/sda1 ro quiet

and add vga=791 so the line looks like this:
kernel       /boot/vmlinuz-2.6.26-1-amd64 root=/dev/sda1 ro quiet vga=791

Now reboot the machine and the tty resolution will be what you set.

Category: Linux  | Tags: , , , ,  | Leave a Comment