Notes from Fedora Linux Toolbox: 1000+ Commands for Fedora, CentOS, & Red Hat Power Users Christopher Negus 978-0470082911

Download 295.94 Kb.
Size295.94 Kb.
  1   2   3   4   5
Notes from
Fedora Linux Toolbox: 1000+ Commands for Fedora, CentOS, & Red Hat Power Users

Christopher Negus 978-0470082911

last modification: 9/8/15

Ch1: Starting with Fedora Linux


Fedora (

CentOS (

Yellow Dog Linux (


DistroWatch (

Linux Timeline:


Fedora is the rapid-development, cutting edge Linux system

Novell Suse same basic dual-distribution

Debian a high-quality Linux distribution

Many derivative Linux distributions-- Ubuntu Linux, KNOPPIX live CD based on Debian.

Why command line?

GUIs are meant to be easy & intuitive

Almost any time something goes wrong

Remote systems administration

Features not supported by GUI

GUI is broken or not installed

Finding Commands

bash: anycommand: command not found


You mistyped the command name.

anycommand is not in your PATH.

Might need to be the root user for the command to be in your PATH.

anycommand not installed on your computer.

Command and Sample Output Description

type mount Show the first mount command in PATH.

whereis mount Show binary, source, and man pages for mount.

locate Find anywhere in the file system.

which umount Find the umount command anywhere in your PATH or aliases.

rpm -qal |grep umount Find umount in any installed package.

yum whatprovides bzfs find out which package provides some feature or file

yum search somefise find any packages matching in the description, summary & package fields
Command Reference Info

-h or –help

ls --help | less

apropos crontab

whatis cat

man find

info ls

Other Notes

Installing Kali version 1.0.4 (Backtrack 6 ish)

I had display resolution problems after I did all of this, so it is a work in progress

1. Download the correct iso from here:

2. Open vmware (fusion or workstation)

3. Install kali from iso

I left most stuff at the default install setting except I bumped RAM to 1024

Before you do anything else copy the vmware file to a backup if possible.

4. Log in as root

5. Open terminal

6. apt-get update --fix-missing

7. apt-get install kde-plasma-desktop (from here)

I deviated from the video and set the display manager to kdm

Other instructions can be found here

8. apt-get install yakuake

Up to here it seems to work

9. apt-get install open-vm-tools (from here)

Ended up with 9GB used out of the 20GB I allocated to it

Ch2: Installing and Adding software

USB flash:

Get diskboot.img from one of the online mirrors then execute:
dd if=/media/cdrom/diskboot.img of=/dev/sda
Choosing how install proceeds:

boot: linux text

Other boot options (p17 -- 10%):

Boot Prompt HOWTO (



Installation screens (p18 -- 11%)

Test media, Language, Keyboard, Install or upgrade, Disk partitions, boot loader, network, time zone, root password, software packages, reboot


repos (p21 -- 12%)

yum list

yum info wordpress

yum search mp3

yum whatprovides ogg123

yum install wordpress

yum groupinstall XFCE

yum update


yum --disablerepo=livna search yum-utils

yum --enablerepo=livna install mplayer

yum –exclude=somepackage update

rpm: (14%)

rpm -ivh some.rpm

rpm -Uvh some.rpm

rpm -e badpackage

rpm -q or -qa or -ql somepackage or rpm -qa | grep ogg

rpm -qi somepackage or -ql somepackage or -qlp some.rpm

Ch 3: Using the shell

To get use of the function keys in your virtual machine on a Macbook: in the virtual machine’s settings under keyboard & mouse set Mac Profile

Basic use:

gnome-terminal -x alsamixer Start terminal with alsamixer displayed



Virtual Terminals

Ctrl-Alt-F1 to F6

ps ps a ps au ps ax ps aw

/etc/inittab & upstart

bash history


history 5

!! (rum previous command)

Ctrl-r to search for string in history
Command line completion

tracer Command completion: Completes to traceroute command

cd /home/ch File completion: Completes to /home/chris directory

cd ~jo User homedir completion: Completes to /home/john

echo $PA Env variable completion: Completes to $PATH
Redirecting stdin, stdout, stderr

ls /tmp /tmpp

ls /tmp /tmmp > output.txt

ls /tmp /tmmp 2> errors.txt

ls /tmp /tmmp 2> errors.txt > output.txt

ls /tmp >> output.txt

ls /tmp 2> /dev/null

mail chris < /etc/hosts

ls /tmp | sort

ls /tmp/ /tmmp 2> /dev/null | sort

rpm -qa | grep -i sql | wc -l
Using backticks, you can execute one section of a command line first and feed the output of that

command to the rest of the command line. Here are examples:

rpm -qf `which ps`

ls -l `which traceroute`


pwd, whoami

Using alias

~/.bashrc or /etc/bashrc

alias ll="ls -lh"

alias la="ls -lah"

alias cl="cd /var/log"

alias ct=”cd /usr/local/tomcat”



watch cat /proc/loadavg


su bob

sudo & /etc/sudoers (root ALL=(ALL) ALL)
Environment variables

export PS1='\e[1A\e[s\e[H\e[37;41;1m\e[K \e[1C\u@\h \e[5C \w \e[5C \d \e[5C [\A] \e[0m\e[u\n--> '

PS1, PS2, PS3, PS4

set & env

export ABC=123

export PATH=$PATH:/home/fcaen

NEVER NEVER put . In your path
Simple shell scripts


java scripts

DailyQuote (~/java & ~/Dropbox/Ike/4361/Examples



chmod u+x also talk about file permissions (table 4.1 22% loc 830)


if [ $MYSTRING = abc ] ; then

echo “The variable is abc”

To negate the condition


if [ $MYSTRING != abc ] ; then

echo “The variable is not abc”

Examples testing for numbers


if [ $MYNUMBER -eq 1 ] ; then echo “MYNUMBER equals 1”; fi

if [ $MYNUMBER -lt 2 ] ; then echo “MYNUMBER less than 2”; fi

if [ $MYNUMBER -le 1 ] ; then echo “MYNUMBER less than or equal to 1”; fi

if [ $MYNUMBER -gt 0 ] ; then echo “MYNUMBER greater than 0”; fi

if [ $MYNUMBER -ge 1 ] ; then echo “MYNUMBER greater than or equal 1”; fi

Testing File names

if [ -e $filename ] ; then echo “$filename exists”; fi

if [ -f “$filename” ] ; then

echo “$filename is a regular file”

elif [ -d “$filename” ] ; then

echo “$filename is a directory”


echo “I have no idea what $filename is”

Other file test operators (table 3.1 p46 20% loc 728)
case “$VAR” in


{ action1 };;


{ action2 };;


{ default action } ;;


for NUMBER in 0 1 2 3 4 5 6 7 8 9


echo The number is $NUMBER

for FILE in `/bin/ls`; do echo $FILE; done


while [ $x -le 5 ] do echo "Welcome $x times" x=$(( $x + 1 )) done


until [ $VAR -eq 3 ]; do echo $VAR; VAR=$[$VAR+1]; done
#!/bin/bash #simple script to show command line args and if test echo $0 echo $1 echo $2 if [ "$1" ]; then echo string not empty else echo string empty fi


bash -x

      1. Download 295.94 Kb.

        Share with your friends:
  1   2   3   4   5

The database is protected by copyright © 2022
send message

    Main page