Linux commando's
Network Manager
-
List hardware.
-
List network info.
-
The command “ss” stands for socket statistics and shows information similar to netstat command.
It can display more TCP and state informations than other tools.
-
Active internet connections
ss -tp | grep -v Recv-Q | sed -e 's/.*users:(("//' -e 's/".*$//' | sort | uniq
sudo netstat -A inet -p | grep '^tcp' | grep '/' | sed 's_.*/__' | sort | uniq
-
keep an eye on what's going on
-
read the configuration files again.
to reload
only one changed file ifcfg-ifname, issue a command as follows:
nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
Changes made using tools such as nmcli do not require a reload but do require the associated interface to be put down and then up again.
That can be done by using commands in the following format:
nmcli dev disconnect interface-name
Followed by:
nmcli con up interface-name
nm-tool is utility to report NetworkManager state and devices
handig
-
If you needed sudo but foregot
-
The below command generates a simple web page over HTTP for the directory structure tree and can be accessed at port 8000 in browser till interrupt signal is sent.
python -m SimpleHTTPServer
-
ping and traceroute combined
-
from terminal launch default editor
-
set default editor
sudo update-alternative --config editor
-
The “last” command show the history of last logged in users.
-
command output your external IP address right into your terminal.
-
This commands shows all the processes running currently along with associated child process,
-
To prevent the given command being entered in history
-
The stat in Linux displays the status information of a file or filesystem. The stat shows a whole lot of information about the file which name is passed as argument. Status Information includes file Size, Blocks, Access Permission, Date-time of file last access, Modify, change, etc.
-
show a list of all the mounted filesystem in a nice formatting with specification.
-
clear (screen)
-
How about checking your unread mail from the command line.
curl -u avishek1210@gmail.com --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'
-
This command print real and effective user and group ids.
-
^foo^bar Command
Run the last command with modification, in a single instance.
Suppose I need to run a command ‘ls -l‘ to long list the content of a directory say ‘Desktop’. Accidentally, you type ‘lls -l‘.
-
So now you will have to retype the whole command or edit the previous command using navigation key. That is painful when the command is long.
avi@localhost:~/Desktop$ lls -l
bash: lls: command not found
avi@localhost:~/Desktop$ ^lls^ls
-
This expr command is very much useful in carrying out simple mathematical calculation in terminal.
expr 2 + 3, expr 6 – 3, expr 12 / 3, expr 2 \* 9
-
This command continues to print a given string, till interrupt instruction is given by you.
yes "Tecmint is one of the best site dedicated to Linux, how to"
-
The strace is a debugging tool which is used primarily for troubleshooting purpose in Linux.
root@tecmint [~]# strace pwd
-
Display Date on the Terminal
while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &
watch -t -n1 “date +%T|figlet”
-
This command will create an empty folder ‘forcefsck‘ under root directory. This will force Linux System to check the file system on the very next boot.
-
Check if port 80 is open or not. We can replace ‘80‘ with any other port number to check if it is opened or closed.
-
The below command will output the ‘Geographical Location‘ of the IP address, provided.
-
The below command outputs, name of process/service using a specific port 80. To better understand run the following command on port 80, it will list all services/processes running on port.
root@localhost:/home/avi# lsof -iTCP:80 -sTCP:LISTEN
-
The below command outputs processes and threads of a user. The option “L” (list threads) and “-F” (Full Format Listing).
How to: Change / Setup bash custom prompt (PS1)
So how do you setup, change and pimp out Linux / UNIX shell prompt?
Most of us work with a shell prompt. By default most Linux distro displays hostname and current working directory. You can easily customize your prompt to display information important to you. You change look and feel by adding colors. In this small howto I will explain howto setup:
a] Howto customizing a bash shell to get a good looking prompt
b] Configure the appearance of the terminal.
c] Apply themes using bashish
d] Howto pimp out your shell prompt
Prompt is control via a special shell variable. You need to set PS1, PS2, PS3 and PS4 variable. If set, the value is executed as a command prior to issuing each primary prompt.
PS1 – The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is \s-\v\$ .
PS2 – The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is >
PS3 – The value of this parameter is used as the prompt for the select command
PS4 – The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is +
How do I display current prompt setting?
-
Simply use echo command, enter:
Output:
-
How do I modify or change the prompt?
-
Modifying the prompt is easy task. Just assign a new value to PS1 and hit enter key:
My old prompt –> [vivek@105r2 ~]$
Output: My new prompt
So when executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:
| \a : | an ASCII bell character (07) |
| \d : | the date in “Weekday Month Date” format (e.g., “Tue May 26”) |
| \D{format} : | the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required |
| \e : | an ASCII escape character (033) |
| \h : | the hostname up to the first ‘.’ |
| \H : | the hostname |
| \j : | the number of jobs currently managed by the shell |
| \l : | the basename of the shell’s terminal device name |
| \n : | newline |
| \r : | carriage return |
| \s : | the name of the shell, the basename of $0 (the portion following the final slash) |
| \t : | the current time in 24-hour HH:MM:SS format |
| \T : | the current time in 12-hour HH:MM:SS format |
| \@ : | the current time in 12-hour am/pm format |
| \A : | the current time in 24-hour HH:MM format |
| \u : | the username of the current user |
| \v : | the version of bash (e.g., 2.00) |
| \V : | the release of bash, version + patch level (e.g., 2.00.0) |
| \w : | the current working directory, with $HOME abbreviated with a tilde |
| \W : | the basename of the current working directory, with $HOME abbreviated with a tilde |
| \! : | the history number of this command |
| \# : | the command number of this command |
| \$ : | if the effective UID is 0, a #, otherwise a $ |
| \nnn : | the character corresponding to the octal number nnn |
| \\ : | a backslash |
| \[ : | begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt |
| \] : | end a sequence of non-printing characters |
Let us try to set the prompt so that it can display today’d date and hostname:
Output:
Now setup prompt to display date/time, hostname and current directory:
$ PS1="[\d \t \u@\h:\w ] $ "
Output:
[Sat Jun 02 14:24:12 vivek@server:~ ] $
How do I add colors to my prompt?
You can change the color of your shell prompt to impress your friend or to make your own life quite easy while working at command prompt.
Putting it all together
Let us say when you login as root/superuser, you want to get visual confirmation using red color prompt. To distinguish between superuser and normal user you use last character in the prompt, if it changes from $ to #, you have superuser privileges. So let us set your prompt color to RED when you login as root, otherwise display normal prompt.
Open /etc/bashrc (Redhat and friends) / or /etc/bash.bashrc (Debian/Ubuntu) or /etc/bash.bashrc.local (Suse and others) file and append following code:
or
Append the code as follows
# If id command returns zero, you ve root access.
then # you are root, set red colour prompt
PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]"
Close and save the file.
My firepower prompt
Check this out:
firepower-prompt.jpg
Color Bash Prompt on Ubuntu and Debian
Red Prompt for root
-
Edit ”/root/.bashrc” and change ”force_color_prompt=yes” like for your user.
Now change the color to red. Search this line:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
and change it to:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Note: For this change to take effect, you must log out then log in again.
Other colors
| Color | Code |
|---|
| Black | 30 |
| Blue | 34 |
| Green | 32 |
| Cyan | 36 |
| Red | 31 |
| Purple | 35 |
| Brown | 33 |
| Blue | 34 |
| Green | 32 |
| Cyan | 36 |
| Red | 31 |
| Purple | 35 |
| Brown | 33 |
tar command examples
-
Create a new
tar archive.
tar cvf archive_name.tar dirname/
-
Extract from an existing
tar archive.
-
View an existing
tar archive.
-
Extract from an existing
tar archive to specifiek folder
tar xvf archive_name.tar -C folder
-
View an existing
tar archive.
To
extract / unpack a
.tar.gz (gzip) file, enter (note -z option):
To
extract / unpack a
.tar.bz2 bzip2) file, enter (note -j option):
extract letters.
zip to the current directory and subdirectories
To
extract all members of letters
.zip into the current directory only:
grep command examples
- Search for a given string in a file (case in-sensitive search).
- Print the matched line, along with the 3 lines after it.
grep -A 3 -i "example" demo_text
- Search for a given string in all files recursively
- search for a text string all files under each directory, recursively with -r option:
$ grep -r "redeem reward" /home/tom/
$ grep -R "redeem reward" /home/tom
By default, the grep command prints the matching lines.
You can pass -H option to print the filename for each match:
$ grep -H -r "redeem reward" /home/tom
Sample outputs:
filename.txt: redeem reward
foobar.txt: redeem reward
...
To just display the filename use the cut command as follows:
$ grep -H -R vivek /etc/* | cut -d: -f1
Sample outputs:
filename.txt
foobar.txt
...
- Suppress file names, use -h option to exclude file names in the output:
$ grep -h -R 'main()' ~/projects/*.c
- Display only words search for word 'getMyData()' only in ~/projects/ dirctory:
$ grep -w -R 'getMyData()' ~/projects/
- Search for two or more words, use the egrep command as follows:
$ egrep -w -R 'word1|word2' ~/projects/
- Hide warning spam
grep command generate error message as follows due to permission and other issues:
No such file or directory
No such device or address
Permission denied
To hide all errors or warning message spam generated by the grep command, append 2>/dev/null to grep command.
This will send and hide unwanted output to /dev/null device:
$ grep -w -R 'getMyData()' ~/projects/ 2>/dev/null
- Display matched text in color
grep --color 'word' file
grep --color -R 'word' /path/to/dir
grep --color -R "192.168.1.5" /etc/
grep --color -R -h "192.168.1.5" /etc/
grep --color -R -h "192.168.1.5" /etc/ 2>/dev/null
- Ignore case distinctions in both the search PATTERN and the input files:
grep -i -R 'word' /path/to/dir
grep -i -r 'income tax' ~/accounting/
find command examples
find
where-to-look criteria what-to-do
You can specify as many places to search as you wish:
find /tmp /var/tmp . $HOME -name foo
- Find files using file-name ( case in-sensitve find)
find -iname "MyCProgram.c"
- Execute commands on files found by the find command
find -iname "MyCProgram.c" -exec md5sum {} \;
Find all empty files in home directory
- Finding all files containing a text string
find / -type f -exec grep -H 'text-to-find-here' {} \;
ssh command examples
- Login to remote host
ssh -l jsmith remotehost.example.com
- Debug ssh client
ssh -v -l jsmith remotehost.example.com
- Display ssh client version
ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
sed command examples
- When you copy a DOS file to Unix, you could find \r\n in the end of each line.
This example converts the DOS file format to Unix file format using sed command.
- Print file content in reverse order
sed -n '1!G;h;$p' thegeekstuff.txt
- Add line number for all non-empty-lines in a file
sed '/./=' thegeekstuff.txt | sed 'N; s/\n/ /'
awk command examples
- Remove duplicate lines using awk
awk '!($0 in array) { array[$0]; print }' temp
- Print all lines from /etc/passwd that has the same uid and gid
awk -F ':' '$3==$4' passwd.txt
- Print only specific field from a file.
awk '{print $2,$5;}' employee.txt
vim command examples
- Go to the 143rd line of file
- Go to the first match of the specified
vim +/search-term filename.txt
- Open the file in read only mode.
diff command examples
- Ignore white space while comparing.
diff -w name_list.txt name_list_new.txt
2c2,3
< John Doe --- > John M Doe
> Jason Bourne
sort command examples
- Sort a file in ascending order
- Sort a file in descending order
- Sort passwd file by 3rd field.
sort -t: -k 3n /etc/passwd | more
export command examples
- To view oracle related environment variables.
export | grep ORACLE
Courier>declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"
- To export an environment variable:
export ORACLE_HOME=/u01/app/oracle/product/10.2.0
xargs command examples
- Copy all images to external hard-drive
ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory
- Search all jpg images in the system and archive it.
find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz
- Download all the URLs mentioned in the url-list.txt file
cat url-list.txt | xargs wget –c
ls command examples
- Display filesize in human readable format (e.g. KB, MB etc.,)
ls -lh
-rw-r----- 1 ramesh team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz
- Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr
- Visual Classification of Files With Special Characters Using ls -F
Attributen list and set
lsattr /etc/elasticsearch/elasticsearch.yml
chattr -i /etc/elasticsearch/elasticsearch.yml
chattr +i /etc/elasticsearch/elasticsearch.yml
pwd command
- Print working directory.
What else can be said about the good old pwd who has been printing the current directory name for ages.
cd command examples
- to toggle between the last two directories
Use
- to automatically correct mistyped directory names on cd
Use “
gzip command examples
- To create a *.gz compressed file:
- To uncompress a *.gz file:
- Display compression ratio of the compressed file using gzip -l
gzip -l *.gz
compressed uncompressed ratio uncompressed_name
23709 97975 75.8% asp-patch-rpms.txt
shutdown command examples
- Shutdown the system and turn the power off immediately.
- Shutdown the system after 10 minutes.
- Reboot the system using shutdown command.
- Force the filesystem check during reboot.
ftp command examples
Both ftp and secure ftp (sftp) has similar commands.
To connect to a remote server and download multiple files, do the following.
ftp IP/hostname
ftp> mget *.html
To view the file names located on the remote server before downloading, mls ftp command as shown below.
ftp> mls *.html -
/ftptest/features.html
/ftptest/index.html
/ftptest/othertools.html
/ftptest/samplereport.html
/ftptest/usage.html
crontab command examples
- View crontab entry for a specific user
- Schedule a cron job every 10 minutes.
* /10 * * * * /home/ramesh/check-disk-space
service command examples
Service command is used to run the system V init scripts.
i.e Instead of calling the scripts located in the /etc/init.d/ directory with their full path, you can use the service command.
- Check the status of a service:
- Check the status of all the services.
- Restart a service.
ps command examples
ps command is used to display information about the processes that are running in the system.
While there are lot of arguments that could be passed to a ps command, following are some of the common ones.
- To view current running processes.
- To view current running processes in a tree structure.
H option stands for process hierarchy.
free command examples
This command is used to display the free, used, swap memory available in the system.
Typical free command output. The output is displayed in bytes.
free
total used free shared buffers cached
Mem: 3566408 1580220 1986188 0 203988 902960-/+ buffers/cache: 473272 3093136
Swap: 4000176 0 4000176
If you want to quickly check how many GB of RAM your system has use the -g option.
-b option displays in bytes, -k in kilo bytes, -m in mega bytes.
free -g
total used free shared buffers cached
Mem: 3 1 1 0 0 0-/+ buffers/cache: 0 2
Swap: 3 0 3
If you want to see a total memory ( including the swap), use the -t switch, which will display a total line as shown below.
free -t
total used free shared buffers cached
Mem: 3566408 1592148 1974260 0 204260 912556-/+ buffers/cache: 475332 3091076
Swap: 4000176 0 4000176
Total: 7566584 1592148 5974436
top command examples
displays the top processes in the system ( by default sorted by cpu usage ).
To sort top output by any column, Press O (upper-case O) , which will display all the possible columns that you can sort by as shown below.
Current Sort Field: P for window 1:Def Select sort field via field letter, type any other key to return
a: PID = Process Id v: nDRT = Dirty Pages count
d: UID = User Id y: WCHAN = Sleeping in Function
e: USER = User Name z: Flags = Task Flags
........
To displays only the processes that belong to a particular user use -u option.
The following will show only the top processes that belongs to oracle user.
df command examples
Displays the file system disk space usage.
By default df -k displays output in bytes.
df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 29530400 3233104 24797232 12% /
/dev/sda2 120367992 50171596 64082060 44% /home
df -h displays output in human readable form. i.e size will be displayed in GB’s.
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 3.1G 24G 12% /
/dev/sda2 115G 48G 62G 44% /home
Use -T option to display what type of file system.
df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 ext4 29530400 3233120 24797216 12% /
/dev/sda2 ext4 120367992 50171596 64082060 44% /home
kill command examples
Use kill command to terminate a process.
First get the process id using ps -ef command, then use kill -9 to kill the running Linux process as shown below.
You can also use killall, pkill, xkill to terminate a unix process.
ramesh 7243 7222 9 22:43 pts/2 00:00:00 vim
rm command examples
Get confirmation before removing the file.
It is very useful while giving shell metacharacters in the file name argument.
Print the filename and get confirmation before removing the file.
Following example recursively removes all files and directories under the example directory.
This also removes the example directory itself.
cp command examples
Copy file1 to file2 preserving the mode, ownership and timestamp.
Copy file1 to file2. if file2 exists prompt for confirmation before overwritting it.
mv command examples
Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it.
Note:
mv -f is just the opposite, which will overwrite file2 without prompting.
mv -v will print what is happening during file rename, which is useful while specifying shell metacharacters in the file name argument.
cat command examples
You can view multiple files at the same time.
Following example prints the content of file1 followed by file2 to stdout.
While displaying the file, following cat -n command will prepend the line number to each line of the output.
cat -n /etc/logrotate.conf
1 /var/log/btmp {
2 missingok
3 monthly
4 create 0660 root utmp
5 rotate 1
6 }
mount command examples
To mount a file system, you should first create a directory and mount it as shown below.
You can also add this to the fstab for automatic mounting.
i.e Anytime system is restarted, the filesystem will be mounted.
/dev/sdb1 /u01 ext2 defaults 0 2
chmod command examples
chmod command is used to change the permissions for a file or directory.
Give full access to user and group (i.e read, write and execute ) on a specific file.
Revoke all access for the group (i.e read, write and execute ) on a specific file.
Apply the file permissions recursively to all the files in the sub-directories.
chown command examples
chown command is used to change the owner and group of a file.
\
To change owner to oracle and group to db on a file.
i.e Change both owner and group at the same time.
chown oracle:dba dbora.sh
Use -R to change the ownership recursively.
chown -R oracle:dba /home/oracle
passwd command examples
Change your password from command line using passwd.
This will prompt for the old password followed by the new password.
Super user can use passwd command to reset others password.
This will not prompt for current password of the user.
Remove password for a specific user.
Root user can disable password for a specific user.
Once the password is disabled, the user can login without entering the password.
mkdir command examples
Following example creates a directory called temp under your home directory.
Create nested directories using one mkdir command.
If any of these directories exist already, it will not display any error.
If any of these directories doesn’t exist, it will create them.
mkdir -p dir1/dir2/dir3/dir4/
ifconfig command examples
Use ifconfig command to view or configure a network interface on the Linux system.
View all the interfaces along with status.
Start or stop a specific interface using up and down command as shown below.
uname command examples
Uname command displays important information about the system such as — Kernel name, Host name, Kernel release number, Processor type, etc.,
Sample uname output from a Ubuntu laptop is shown below.
uname -a
Linux john-laptop 2.6.32-24-generic #41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010 i686 GNU/Linux
whereis command examples
When you want to find out where a specific Unix command exists (for example, where does ls command exists?), you can execute the following command.
whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
When you want to search an executable from a path other than the whereis default path, you can use -B option and give path as argument to it.
This searches for the executable lsmk in the /tmp directory, and displays it, if it is available.
whereis -u -B /tmp -f lsmk
lsmk: /tmp/lsmk
whatis command examples
Whatis command displays a single line description about a command.
whatis ls
ls (1) - list directory contents
whatis ifconfig
ifconfig (8) - configure a network interface
locate command examples
Using locate command you can quickly search for the location of a specific file (or group of files).
Locate command uses the database created by updatedb.
The example below shows all files in the system that contains the word crontab in it.
locate crontab
/etc/anacrontab
/etc/crontab
/usr/bin/crontab
/usr/share/doc/cron/examples/crontab2english.pl.gz
/usr/share/man/man1/crontab.1.gz
/usr/share/man/man5/anacrontab.5.gz
/usr/share/man/man5/crontab.5.gz
/usr/share/vim/vim72/syntax/crontab.vim
man command examples
Display the man page of a specific command.
When a man page for a command is located under more than one section,
you can view the man page for that command from a specific section as shown below.
man SECTION-NUMBER commandname
Following 8 sections are available in the man page.
General commands
System calls
C library functions
Special files (usually devices, those found in /dev) and drivers
File formats and conventions
Games and screensavers
Miscellaneous
System administration commands and daemons
For example, when you do whatis crontab, you’ll notice that crontab has two man pages (section 1 and section 5).
To view section 5 of crontab man page, do the following.
whatis crontab
crontab (1) - maintain crontab files for individual users (V3)
crontab (5) - tables for driving cron
man 5 crontab
tail command examples
Print the last 10 lines of a file by default.
Print N number of lines from the file named filename.txt
View the content of the file in real time using tail -f.
This is useful to view the log files, that keeps growing.
The command can be terminated using CTRL-C.
less command examples
less is very efficient while viewing huge log files, as it doesn’t need to load the full file while opening.
One you open a file using less command, following two keys are very helpful.
CTRL+F – forward one window
CTRL+B – backward one window
su command examples
Switch to a different user account using su command.
Super user can switch to any other user without entering their password.
Execute a single command from a different account name.
In the following example, john can execute the ls command as raj username.
Once the command is executed, it will come back to john’s account.
[john@dev-server]$ su - raj -c 'ls'
Login to a specified user account, and execute the specified shell instead of the default shell.
su -s 'SHELLNAME' USERNAME
mysql command examples
mysql is probably the most widely used open source database on Linux.
Even if you don’t run a mysql database on your server, you might end-up using the mysql command ( client ) to connect to a mysql database running on the remote server.
To connect to a remote mysql database.
This will prompt for a password.
mysql -u root -p -h 192.168.1.2
To connect to a local mysql database.
If you want to specify the mysql root password in the command line itself, enter it immediately after -p (without any space).
yum command examples
To install apache using yum.
To upgrade apache using yum.
To uninstall/remove apache using yum.
rpm command examples
To install apache using rpm.
rpm -ivh httpd-2.2.3-22.0.1.el5.i386.rpm
To upgrade apache using rpm.
rpm -uvh httpd-2.2.3-22.0.1.el5.i386.rpm
To uninstall/remove apache using rpm.
ping command examples
Ping a remote host by sending only 5 packets.
date command examples
Set the system date:
date -s "01/31/2010 23:59:53"
Once you’ve changed the system date, you should syncronize the hardware clock with the system date as shown below.
style="background-color: lightgray style="font-family: Courier;">hwclock --systohc –utc
wget command examples
The quick and effective method to download software, music, video from internet is using wget command.
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
Download and store it with a different name.
wget -O taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701
Alphabetical List of Principal Commands
On rpm-based systems, to find out which package owns the command foo (where foo is a standalone executable), use the command rpm -q -f foo.
- translation utility from awk to Perl
- translation utility from ``any'' to Postscript
- print statistics concerning user connect time
- determine whether a file can be accessed
- Adobe utility for viewing pdf files
- used by root to add user to system
- utility to copy or restore files to an archive file. This utility is not part of the basic internal and external programs under Red Hat Linux. It is available as an rpm on the rpmfind.net site.
- enables login on terminals. See getty, mgetty, and uugetty.
- list mail aliases
- assign name to specified command list. This is actually a shell builtin.
On my Red Hat system, I have global alias commands in my /etc/bashrc file and in my /.bashrc file.
On my Slackware box, I have made the rm command a little bit safer with
so that you can't recursively delete your /dev directory without telling the system you're sure you want to do it.
- utility to convert to and from different Linux package formats.
Can handle Debian (deb), Stampede (stp), Red Hat (rpm) and Slackware (tgz) packages.
- display command names based on keyword search
- printer filter called by lpd to deal with printing different types of files.
is a fairly sophisticated print filter. It is not set up by default in Slackware.
It used to be available on the second cd of a Slackware distribution.
Since 4.0, it is available as one of the main packages in the ap set.
Read the mail that the installation program sends to the root user. I believe that Red Hat uses its own printer filters.
- create, modify and extract from archives
- print machine architecture type
- the portable GNU assembler
- AfterStep laptop advanced power management utility
- a shell, a very simple shell program sometimes used on boot diskettes since it takes up much less space than bash, tcsh, zsh, etc.
- AfterStep cpu load monitor
- AfterStep mail checking utility
- AfterStep utility to monitor modem status
- a spell checking program along the lines of ispell
- X Window postit note utility
- executes a shell script at specified time. Use atq to show pending jobs, and atrm to remove jobs from the queue.
usage:
or:
- shows pending jobs queued by at. If run by root, shows everybody's pending jobs.
- removes pending jobs queued by at. Use atq to determine the identities of various jobs.
usage:
- searches for and process patterns in a file
- print banner to standard output. Syntax is
banner [option] [characters]
- Bourne again shell. This is the default shell in the Red Hat installation.
- queue, examine, or delete jobs for later execution. See at.
- a language (compiler) similar to C, with unlimited precision arithmetic
- send process with pid ``PID'' to the background. This is the same as executing [Ctrl]z while interacting with the running process. This is a shell builtin.
- puts a job in the background. This is a shell builtin.
- mail notification utility. Notifies user of mail arrival and sender's name.
- displays or redefines key bindings. This is a shell builtin.
- parser generator similar to yacc
- a powerful backup utility program. Commercial. Demonstration versions are often included with Linux distributions such as Red Hat.
- equivalent to ash
- used to uncompress files compressed with bzip2
- parser generator
- compresses with algorithm different from gzip
- view bzipped files
- invokes GNU C and C++ compiler
- displays a 12-month calendar for the given year or a one-month calendar of the given month
- combine, copy standard input to standard output. Used to join or display files.
- change working directory. This is a shell builtin in bash, tcsh and zsh.
- command line utility for playing audio cds
- similar to fdisk, but menu-driven
- used to interact with a modem via a chat script
- changes group associated with file. Can be used to change the group associated with subdirectories and files of a directory.
usage:
or:
- Query or update system services/daemons for different runlevels. Manipulates the various symbolic links in /etc/rc.d.
This utility is included with many rpm-based distributions such as RedHat and Mandrake. It is designed to work with System V initialization scripts.
Graphical tools for configuring system services include ntsysv, tksysv and ksysv (the latter is a KDE utility).
- set permissions (modes) of files or directories. A value of 4 is used for read permission. A value of 2 is used for write permission.
A value of 1 is used for execute permission. See umask for default file permissions upon file creation.
Chmod can also be used to change the suid bit on files. The syntax for the symbolic version is
chmod [options] who operation permission file-list
The syntax for the absolute version is
chmod [options] mode file-list
To set the uid to the owner's permissions, use
To set the uid to the group's permissions, use
There are lots of security issues related to allowing a program to have root's permissions when run by an ordinary user.
I don't pretend to understand all of these issues.
- changes ownership of a file. Can be used recursively.
usage:
or:
- change default shell
- creates or records changes in an RCS file
- clear screen command
- compares two files for differences
usage:
- retrieves an unencoded version of an RCS file
- compares sorted files
- automatically configures software source code
- color xterm program. Under Red Hat, this is just a link to xterm-color.
- graphical system configuration tool under Red Hat.
- copies on or more files. Recursive copying is one simple way of archiving part of a directory structure. Use the command as follows:
cp -r /sourcedirectory /targetdirectory
- direct copy of files to an output device. Allows creation of archive file spanning multiple diskettes.
Allows one directory structure to be mirrored elsewhere on the partition or on another partition.
In order to back up an entire directory structure on diskettes, cd to the directory and use the following command:
cpio
find . -depth -print | cpio -ov > /dev/fd0
To restore from diskettes, use:
The cpio command will prompt the user to insert more diskettes as they are needed.
The command for mirroring a directory structure is the following:
find . -depth -print | cpio -pv /destinationdirectory
This copies the working directory and its contents, including subdirectories, into /destinationdirectory.
In order to copy an individual file which is larger than a floppy, use:
find . -name nameoffile -print | cpio -iv > /dev/fd0
- Slackware tool to install, uninstall and query packages. Front end to installpkg, removepkg, makepkg.
This is the graphical version that uses ncurses.
- GNU C-compatible compiler preprocessor
- schedules command to run at regularly specified time
- run C shell
- separate files into sections. See also split.
- manages concurrent acces to files in a hierarchy. Stands for concurrent version system.
Is built on RCS. It stores successive revisions of files efficiently and ensures that access to files by multiple developers is done in a controlled manner.
Useful when many developers are working on the same project.
- selects characters or TAB-separated fields from lines of input and writes them to standard output
- displays or sets date and time
usage:
or:
- direct copy of file from one device to another. Can be used to make copies of boot or root diskettes for installing Linux.
It can be used, for example, to make and exact copy of a floppy disk, as follows. First, place the diskette to be copied in the floppy drive. Then,
dd if=/dev/fd0 ibs=512 > floppy.copy
Replace the diskette with a fresh diskette.
dd if=floppy.copy bs=512 of=/dev/fd0
The ibs and bs options specify the block sizes for input and for both input and output.
A boot disk image can be directly copied to a floppy using the second of the two dd commands above.
- declares attributes for a variable (same as typeset). This is a shell builtin.
- displays capacity and free capacity on different physical devices such as hard drive partitions and floppy drives that are mounted on the file system.
Gives free space in blocks. With the (undocumented) option -h, the program gives free space in Mb or Gb.
This is useful for those accustomed to thinking of the capacity of a high-density 3.5 inch diskette as 1440k.
- displays differences between two files
usage:
- compares three files and reports on differences
- used to set up a SLIP or PPP connection. It can be used to set up an outgoing SLIP connection or an incoming connection.
- used for setting up incoming dip connections. See the man page for dip.
- a variation of the GNU ls command that defaults to printing file names in columns
- set colors for GNU ls command. In Slackware, this command is run by the /etc/profile script.
Then, whenever xterm is run with the -ls (login shell) option, ls displays different colors for different types of files.
Typical usage is eval `dircolors -b`. In Red Hat and Mandrake, I get color directories by aliasing the ls command (see below).
-in ubuntu kan in ~> .bashrc woorden aangevuld met LS_COLORS=$LS_COLORS:'di=0;35:' ;export LS_COLORS, hierdoor wordt de directory in een andere kleur getoond
LS_COLORS=$LS_COLORS:'di=0;35:' ;export LS_COLORS
- set display for output of programms under X Windows.
Can be used to run a program on a remote machine while displaying the output on a local machine.
The remote machine must have permission to send output to the local machine. This is actually an environment variable.
See the more detailed discussion in connection with the xhost command below.
- displays messages from /var/log relative to the most recent boot
- invoke the DOSEMU DOS emulator
- displays information on disk usage. The command
will display detailed disk usage for each subdirectory starting at root, giving files sizes in bytes.
- print information about the keyboard driver's translation tables to standard output
- send a dvi file to a Laserjet printer. There are specialized versions for individual models of Laserjet printer.
- specialized version of dvilj for the IIp series of printers. See above
- send a dvi file to a Postscript printer, to a Postscript capable Laserjet printer, or to a file (with the -o option).
There is a switch to print only a subset of the pages, and another switch to print in landscape mode.
Use -t landscape, which is one of the arguments to the paper type switch. If you have one page of a document that is a wide table,
and you wish to print this in landscape mode, use
dvips filename -pp pagenumber -t landscape
- check an ext2 filesystem. The syntax is
where the filesystem is on /dev/devicename. The device should not be mounted, and this program must be run as root.
- write arguments to standard output. One use is to print out information about environment variables, as in
echo $PATH - list paths to search
echo $HOME or echo ~ - list name of home directory
This is a shell builtin.
- a dynamic resource editor for X Toolkit applications. Allows the user to change X resources for individual applications.
- fax program
- convert between fax, text, bit-map and gray-scale formats
- search files for lines that match regular expressions. Runs faster than grep and fgrep.
- an interactive mail system
- a version of the vi text editor
- screen oriented text editor
- desplay the current environment or set a variable equal to a new value
- scans and evaluates the command line. See dircolors command. This is a shell builtin.
- interactive command-based editor. The man page lists it as being the same as vim, an improved version of vi.
- system call which creates a subshell to execute a binary or a script. This is a shell builtin.
- a variation of the exec command.
- exit a shell. This is a shell builtin.
- convert tabs in files to spaces and write to standard output
- a program that ``talks'' to other interactive programs according to a script. Following the script,
Expect knows what can be expected from a program and what the correct response should be.
An interpreted language provides branching and high-level control structures to direct the dialogue.
In addition, the user can take control and interact directly when desired, afterward returning control to the script.
- place the value of a variable in the calling environment (makes it global). This is a shell builtin.
- utility evaluates an expression and displays the result
- FORTRAN to C translator
- FORTRAN 77 compiler
- null command that returns an unsuccessful exit status
- simple user interface to efax and efix programs
- views, edits, and executes commands for the history list. This is a shell builtin.
- low level format of a floppy device
- retrieve mail from a remote mail server and pass it to local SMTP agents on the local machine
- used to partition hard drives
usage:
- bring a background or stopped process with pid ``PID'' to the foreground.
This is a shell builtin. If only one process is running in background mode, fg with no argument is sufficient to bring it to the foreground
- search for patterns in files
- displays classification of a file or files according to the type of data they contain
- find files according to a large variety of search criteria. The find command that I use the most is
find . -name filename -print
in order to find files matching a particular name on the working directory and all subdirectories. Find can be incredibly powerful, but it is incredibly obscure.
- display information about a specified userid or userids
- simple text formatting utility. Tries to make all nonblank lines nearly the same length.
- break lines of specified files so they are no wider than a specified lengths
- available in the bsdgames package in Slackware and other distributions.
Put a call to fortune in /etc/profile and get something inspirational or amusing every time you fire up an xterm as a login shell.
- gives used and free memory on system along with other useful information
- takes a DOS text file from stdin and sends a UNIX file to stdout.
- file system check and repair
- file transfer over network
- C++ compiler
- GNU Fortran 77 compiler
- GNU awk, mostly for processing delimited text files
- invoke C, C++ compiler
- parses arguments to a shell script. This is a shell builtin.
- print kernel's scancode-to-keycode mapping table
- set of printing utilities. It seems to be obligatory to have this if a TEX installation such as teTEX is installed.
How they communicate with one another is somewhat obscure.
- Aladdin ghostscript interpreter/previewer
- image manipulation and paint program
- Red Hat graphical front end for the rpm package installer and manager.
- used to find a string within a file. The -i option returns matches without regard to case.
The -n option means that each line of output is preceded by file name and line number. The -v option causes non-matched lines to be printed.
usage:
or:
or:
or:
- create a new group on the system
- shows which groups you are in
- Gnu grand unified bootloader. Can be used instead of lilo to boot multiple operating systems.
I encountered a couple of snafus trying to install grub on my home machine after installing Mandrake 8.0 and choosing the lilo bootloader during the initial install.
The Mandrake installation program set up /boot/vmlinuz as a symlink to the actual kernel, vmlinuz-2.4.3-20mdk.
It took me a while to figure out that grub doesn't understand symbolic links. The documentation suggests installing grub on a diskette using the ``dd'' command.
This refused to work, but
did work. The single quotes are necessary. The files necessary to run grub are normally located in /boot/grub.
Once the file menu.lst has been edited and appropriated entries added to boot the different operating systems on one's hard disk(s),
the following sequence of commands can be used to install grub in the master boot record (MBR) sector of the hard disk:
Here, the x should be replaced by the partition where the /boot/grub directory is located, which is probably the root partition of the Linux system.
Note that grub has its own conventions for naming devices and numbering partitions, so that for example a partition which is called hda6 under Linux will be called (hd0,5) by grub.
- command to install grub on the hard drive (or floppy drive).
- used to uncompress files compressed with gzip
- PostScript and PDF previewer, based on ghostview
- see vi
- compresses executables
- used to compress or decompress files
- shut down system as root, without reboot, immediately
- remembers the location of commands in the search path. This is a shell builtin.
- displays first part of a file
- command for viewing and manipulating the shell command history list
- look up host names using domain server
- used to get or set hostname. Typically, the host name is stored in the file /etc/HOSTNAME.
- used to query and set the hardware clock
- commercial fax program
- display userid and groupid
- daemon which starts up other daemons on demand. Configured in /etc/inetd.conf.
- display (as root) information on network interfaces that are currently active.
First ethernet interface should be listed as eth0, second as eth1, etc.
First modem ppp connection should be listed as ppp0, etc. The ``lo'' connection is ``loopback'' only.
- shut down the network interface
- start up the interface
- display system information. This is the GNU hypertext reader.
- the mother of all processes, run at bootup, executes commands in /etc/inittab. Can be used (with root privileges) to change the system run level.
usage:
- used (by root) to install modular device drivers
- Slackware command to install one of the packages from the program sets
- interrupt key, usually [Ctrl-C]
- checks files for spelling errors
usage:
- programmer's file editor. Behaves like emacs. Has modes for TEX, FORTRAN, C, etc.
- displays list of current jobs in the background. This is a shell builtin.
- simple WordStar-like text editor. It can be invoked in emacs emulation mode with jemacs and in WordStar emulation mode with jstar.
- Joseph's Own Version of Emacs. A simple emacs clone.
- print current keyboard mode
- GUI to add/remove kernel modules (as root in X terminal).
- kernel daemon, a process that stays in memory and does all sorts of useful stuff, like automatic loading of device driver modules
- a utility program that comes with KDE that allows users to switch on the fly among different international keyboards. It can be used under different window managers than kfm.
- sends a signal to (especially to terminate) a job or process. This is a shell builtin in bash, tcsh and zsh.
- kill processes by name. Kill all processes which are instances of the speciffied program. Also used to send signals to processes or restart them.
- kill all processes except the ones on which it depends
- generate a listing of user logins
- prints the last login times of all users
- compile a LATEX file
- creates the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line,
in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib).
Ldconfig checks the header and file names of the libraries it encounters when determining which versions should have their links updated.
Ldconfig ignores symbolic links when scanning for libraries.
- list the shared libraries on which a given executable depends, and where they are located
- display reminder at specified time
- Linux alternative to ``more'' command. Displays text files, one screenful at a time. When less pauses, there is a large number of available commands to tell it what to do next.
One can scroll both forwards and backwards.
- evaluates a numeric expression. This is a shell builtin.
- installs boot loader on the boot sector of a hard drive, of a diskette, or in another location. My 486 has a hard drive that is too large for the machine's BIOS,
so I have to boot from a floppy. To create a boot diskette, I do the following (as root):
/sbin/fdformat /dev/fd0H1440
mount -t ext2 /dev/fd0 /mnt/floppy
cp -dp /boot/* /mnt/floppy
/sbin/lilo -C /etc/lilo.flop
The -C option to lilo has lilo use the lilo.flop file instead of the default lilo.conf.
- interactive tool for configuring Linux system. Uses X if loaded. This is a Gnome tool. It comes with my Red Hat distribution, and is not included with Slackware.
It would seem to be the easiest way to configure Linux under Slackware. Version 1.15 is available for Slackware.
There is a pretty good introduction to the use of linuxconf in the Red Hat 5.2 installation manual, which is available online at their web site.
- creates a link to a file. Used to create hard links and, with the -s option, symbolic links which can link files on different disk partitions. The syntax is
ln [options] source [dest]
- find the file name which contains the string ``filename''. The syntax is easier than the find command.
- temporarily lock terminal
- create semaphore file(s), used to limit access to a file
- log in to system
- consult /etc/utmp for user's login name
- execute logout as individual user and bring up login: prompt
- look for strings in files
- show print jobs that are waiting
- send file to be printed
- cancel a job from print queue
- list directory contents. To get colored directory listings under Red Hat, Mandrake, etc., use
To get this all the time, add
alias ls='ls -color=auto'
to .bashrc. The following command
alias ls='ls -Fskb -color=auto'
will give directory listings in color, with file sizes in kilobytes, and append a character to the file to indicate its type.
- list attributes of files in ext2 file system
- used (by root) to show kernel modules currently loaded
- utility to display information on pci buses and hardware devices attached to them. Part of the pciutils package that comes with many Linux distributions.
- utility to display information about pnp devices. Part of the pcmcia or kernel-pcmcia package, depending on the distribution.
- an implementation of the traditional UNIX macro processor.
It can be used with the sendmail configuration package in Red Hat (and Slackware) to generate a sendmail.conf
configuration file without having to edit the configuration file directly.
- general purpose printer filter. See apsfilter above. apsfilter is the printer filter that comes with the Red Hat and Slackware distributions.
- sends or reads electronic mail
- keeps a set of programs current. This is a utility that helps when developing a set of programs.
It works by executing a script called makefile, Makefile or GNUmakefile in the working directory.
It is very often used in combination with configure when compiling and installing noncompiled software packages.
- command in Slackware to do just what the name says
- executable script to make device files on /dev
- displays information from online Unix reference manual
- attempt to determine path to manual pages
- Midnight Commander file manager and visual shell
- enables/disables reception of messages
- terminal program
- create a directory
- create a file system (format) on a device or partition. Should be invoked after lowlevel formatting of the disk using fdformat.
It has several versions which are all links to the basic program, such as mkfs.ext2 and mkfs.msdos.
- creates a Linux swap space on the specified hard disk parition (root privileges neede)
usage:
- list file contents, stopping after each full screen
- mount device using filesystem of type [fstype] with device name [device] at the location [mountpoint] in the filesystem directory tree
mount -t [fstype] [device] [mountpoint]
- mount all filesystems according to the specifications in /etc/fstab
- mouse configuration utility under Red Hat. Located in /usr/sbin.
- print multiple pages per sheet on a Postscript printer. Can also be used to print a page in landscape mode.
- package of MS-DOS utilities. Includes the following commands.
mcd - changes working directory on DOS disk
mcopy - copies DOS files from one directory to another
mdir - lists contents of DOS directories
mformat - adds DOS formatting information to a disk
mtype - displays contents of a DOS file
The default device for execution of these commands is /dev/fd0 and can be referred to as ``a:''.
- moves (renames) files
- used (as root) to set up network
- rebuilds the /etc/aliases database used by sendmail. Must be rerun every time /etc/aliases is modified for the changes to take effect.
- similar to login. Changes user's identification
- sets the priority of the program ``program_name''.
- lists the symbols from object files objfile. If no object files are given as arguments, nm assumes `a.out'.
- runs a command that keeps running after logout. The command is in principle immune to hangups, and must have output to a non tty.
According to Linux in a Nutshell, this is necessary only in the Bourne shell, since modern shells preserve background processes by default.
- run level editor under Red Hat. This is the equivalent of tksysv, but does not require a graphical interface.
- color xterm program. The man page for nxterm under Red Hat brings up the same page as xterm.
- dumps contents of a file
- change login password
- joins corresponding lines from files
- updates source code. Attempts to update a file from a file of change information, or pathces, created by diff.
- determine validity and portability of filenames
- part of the pdftex program suite. Produces pdf output from a LATEX file.
- produces pdf output from a TeX file. See also pdflatex.
This program is part of the tetex 0.9 distribution that is included with Red Hat 5.2 and above, and with Slackware 4.0 and above. It is also available as a separate program.
- practical extraction and report language
- display data one screenful at a time
- simple screen oriented text editor. It is included as part of the Pine program.
- check if Internet computer is responding. Can also measure the time it takes the queried computer to respond.
- Slackware tool to install, uninstall and query packages. Front end to installpkg, removepkg, makepkg. The cpkgtool is the ncurses graphical version of this program.
- retrieve mail via the Post Office Protocol. Supports POP2 and POP3.
- pops the top directory of the directory stack and uses cd to change to that directory. This is a shell builtin.
- paginates files for printing
- display list of environment variables
- run (as root) in an X terminal to configure your printer(s)
- displays status of processes. Use the -a option for processes for all users. Use the -x option to include processes not attached to a terminal.
- display processes in the form of a tree structure. Killing a parent process will also kill all the children and their descendants.
- pushes the argument onto the top of the directory stack and uses cd to change to that directory. This is a shell builtin.
- print absolute path of working directory. This is a shell builtin.
- checks the integrity of password and shadow files
- converts passwords to the shadow password format
- unconverts passwords from the shadow password format. Generates a standard Unix password file.
- interpreted, interactive, object-oriented programming language
- copy one or more files to or from remote computer. The syntax is poorly explained in the documentation that I have, including the man pages. Usage is:
rcp filename username@remotehost:path
The user's home directory on the remote system must contain the file .rhosts with a list of users (preceded by the full domain name or exact IP address of their machine) with access privileges.
- creates or changes the attributes of an RCS file. Stands for Revision Control System.
- query/set image root device, swap device, RAM disk size, or video mode in kernel
- reads line from standard input. This is a shell builtin.
- declares a variable to be read only. This is a shell builtin.
- in Slackware, reboots the system. Seems to be equivalent to shutdown -r now in generic Linux.
- resets the priority of process ``program_name''.
- used to reset the screen characteristics. This is useful if the screen gets messed up from, for example, trying to display a binary file in an xterm.
- exits from a function. This is a shell builtin.
- prints a summary of the history of an RCS file
- log in to remote computer. The general syntax is as follows, using the UQAM Nobel machine as an example:
rlogin -l userid nobel.si.uqam.ca
The remote computer must recognize the local user and the local machine. See the rcp command for how to set up the .rhosts file on the remote machine.
- remove files or directories. With the -r (recursive) option (very dangerous!), can be used to remove the contents of a specified directory including all subdirectories.
- interpret and handle remote mail received via uucp
- remove empty directories
- used to remove modular device drivers
- show routing table. The n option returns numerical addresses rather than names.
- invokes the Red Hat package manager in command line mode.
I often use this command in query mode to query packages about what files they contain and to find out which package owns a particular file. Examples are
rpm -qil foo. Gives package information and a file list for the package foo.
rpm -qfil foo. Gives package information and a file list for the package that owns the file foo. Foo must be in the working directory, or the full path to foo must be specified.
We need to find out about installing the rpm package on a Slackware box. It's probably better to use a package converter such as alien.
- an extremely useful utility on Slackware systems that converts rpm packages to tgz format. They can then be installed using the installpkg command (or pkgtool).
- execute shell command on a remote computer. See rcp and rlogin.
- summarize host's status: uptime, load averages, and current time
- show host status of local machines
- list who is logged on local machines
- write to all users over a network
- show who is logged in on a LAN. The rwho service must be enabled for this command to run.
If it isn't, run ``setup'' as root. I don't understand this last remark, which comes from ``Linux Newbie Administrator Guide''.
- a terminal program similar to xterm, but which has less features and uses less memory
- edits a file (not interactively). Also a tool for processing text files.
- set or display value of shell variables. This is a shell builtin. The command
prints the current user environment, giving the values of currently defined variables.
- set or display value of environment variables
- used by root to configure a serial port
- set terminal attributes for a virtual console
- set the id of a program when it is run. Used, for example, to give root privileges to a program run by an ordinary user.
This is actually done by running the chmod program as root. See the chmod command for the syntax.
- Slackware program to set up program sets and configure system. Setup devices and file systems, mount root file system
- standard UNIX shell. On Linux, just another name for bash.
- promotes each command-line argument. This is a shell builtin.
- show information about an nfs server
- reboot or shut down system as root, after specified amount of time. With the -r option, reboot. With the -h option, halt the system.
usage: shutdown -r minutes
- creates process that sleeps for specified interval
- attaches a SLIP interface to standard input. Used to allow dialin SLIP connections.
- sorts and/or merge files
- split file into specified number of segments
- secure shell. Apparently has many of the same functionalities as rlogin, telnet, ftp, rsh, etc., with better security and encryption features.
We may want to learn how to set this up and use it.
- front end to xinit in Linux. This is a script which starts up X clients and shuts down the X server on exit from the window manager.
- start the next X window session on the display 1 (the default is opened on display 0).
One can switch between different graphical displays using [Ctrl][Alt][F7], [Ctrl][Alt][F8], etc.
- sets or displays operating options for terminal
- log in as another user, including root
- allows individual users to have root permission to perform specified tasks
- disables swap disk
- enables swap disk
- provide list of and information about symbolic links
- writes memory buffers to physical devices
- query host for system information
- print file in reverse
- displays the last part of a file
- visual communication program that copies lines from one terminal to that of another user
- file compression and archiving utility. I find the syntax of this command to be frustratingly opaque.
The following works for me. To use this command to unzip gzipped tarballs in verbose mode, use
To create a tarball from files in a given directory and its subdirectories, use
tar -cvzf filename.tgz sourcename
Sourcename can be the name of a single file, a wildcard such as *, or the name of a subdirectory. There seem to be two different conventions concerning gzipped tarballs. One often encounters .tar.gz. The other popular choice is .tgz. Slackware packages use the latter convention. The command can also be used to archive a file, a group of files, or a directory (with its subdirectories) on tape or onto floppies. If the material to be archived exceeds the capacity of the backup medium, the program will prompt the user to insert a new tape or diskette. Use the following command to back up to floppies:
tar -cvf /dev/fd0 filename(s) or directoryname(s)
The backup can be restored with
Tar can be used for other things. To mirror all the files and subdirectories in from-stuff to to-stuff, use the commands
tar cf - . | (cd ../to-stuff; tar xvf -)
No tar file is ever written to disk. The data is sent by pipe from one tar process to another. This example is taken from Running Linux, p.177. To list the table of contents of a tar archive, use
To extract individual files from a tar archive, use
where files is the list of files to extract. When extracting files, tar creates missing subdirectories underneath the current directory in which the cammand is invoked.
- scripting language
- extended version of the C shell
- copy standard input to standard output and one or more files
- used to change run level. Exact run level that corresponds to single-user, multi-user, and X levels depends on distribution.
- remote login over network
- evaluates an expression or compares arguments. This is a shell builtin in bash, tcsh and zsh.
- user interface to TFTP protocol
- displays times for the current shell and its children. This is a shell builtin. Strange, because there is also a /usr/bin/time program on my Red Hat system.
- Netnews reader
- graphical desktop file manager for X
- graphical runlevel editor under Red Hat. Allows root to configure the services that are started at each run level.
- display system load average in graph format
- dynamically displays process status
- update access and modification times of a file. If the file does not exist on disk, an empty file is created.
- translation utility that can be used, for example, to replace specified characters in a text file
- traps a signal. This is a shell builtin.
- null command that returns a successful exit status
- initializes terminal
- shows special file that represents your terminal. Displays the terminal pathname.
- displays how each argument would be interpreted as a command. This is a shell builtin.
- declares attributes for a variaable (same as declare). This is a shell builtin.
- translate underscores to underlining
- establishes the file-creation permissions mask. Usage is
The system subtracts x, y and z from the owner, group and other file permissions that it would otherwise assign to new files. This is a shell builtin.
- finish writing to the device and remove it from the active filesystem. The command umount -a will (re)mount all file systems listed in /etc/fstab.
- remove name previously defined by alias. This is a shell builtin.
- displays information about the system. With no arguments, it displays the name of the operating system.
With the -a option, it displays information about the operating system, the host name, and hardware.
- displays lines of a file that are unique
- removes a variable or function. This is a shell builtin.
- uncompress files compressed with the zip utility, compatible with DOS PKzip
- update file database used by locate command
- shows the time, how long the system has been up, the number of users, and average load.
- same as adduser
- remove an account (as root). The user's home directory and undelivered mail must be dealt with separately.
- prints list of users on the system
- variant of the GNU version of the ls command. Defaults to printing out the long version of directory entries.
- standard screen oriented Unix editor
- vi in read-only mode
- improved vi editor
- query remote host to verify the accuracy of an email address
- display info about userids and active processes
- waits for a background process to terminate. This is a shell builtin.
- displays number of lines, characters and words in a file
- the AfterStep application dock module
- display one-line summary of specified command
- use to find utilities in standard locations
- used to find utilities in search path. Will return the absolute directory path of the named utility program.
- display information about currently logged in userids
- display information about userid that is currently logged in
- front end to tk, an X window extension of tcl
- console based cd player
- graphical cd player program
- send messages to another local user
- starts up the X server. Can be invoked with
X -quiet -query remotemachineaddress
in order to get a graphical login screen on the remote machine. See the discussion in connection with xdm below.
- display advanced power management BIOS information
- converts standard output of one command into arguments for another. This is one of those powerful but obscure commands.
Xargs reads arguments from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines,
and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by arguments read from standard input.
Blank lines on the standard input are ignored.
- graphical mail delivery notification utility
- simple calculator program
- name says it all
- Red Hat utility for configuring settings for X
- used to start an X login session. This can be used to start a login session on a remote system. See the discussion on the following site:
http://www.menet.umn.edu/~kaszeta/unix/xterminal/index.html
See the man pages for X, xdm, and Xserver. As usual, the man pages are pretty obscure. The best single source seems to be the Xserver man pages. After X is configured, X needs to be started at bootup with the command (in /etc/rc.d/init.d/xterm):
X -quiet -query remotemachineaddress
If the address of a nameserver is not configured, then the numeric address of the remote machine rather than its name should be entered. If the machines are connected through ethernet cards and the net, then obviously basic networking has to be set up. Gnome and KDE come with their own versions of X display/login managers, called respectively gdm and kdm.
- view a dvi file compiled under LATEX
- a simple text editor for X
- graphical configuration tool for X
- graphical configuration tool for X
- display an available font in X. Creates a grid in an x-term with one character per rectangle.
- utility for interactive generation of figures
- graphical file manager for X
- tell X server that remote computer has access to your machine and that you will use the remote computer. This can be used to set up remote X sessions.
To set up a remote X session on the UQAM Nobel machine, run the following command on the local machine (one doesn't have to be root to do this)
Then, log onto the remote machine using rlogin (see above) or telnet.
Once logged in, use the following command to get the remote X server to open an X terminal on the local machine:
setenv DISPLAY localhostname:0 ; xterm &
This is valid for csh, which is the default login shell on Nobel. For ksh, (and I think bash) replace with
Other X-based programs such as Netscape or Gauss (graphical version) can also be run on a remote machine with display on the local machine with little trouble.
The local X server is the program that has all of the information concerning the properties of the graphics card and terminal,
so it must be necessary to have X running on the local machine. The following should also work.
After using xhost to give permission to the remote machine to display on the local machine, use
netscape -display localhostname:0.0
Question: can one start the X session on the local machine and then run a remote copy of a window manager?
- start X Window. The command startx is a front end to xinit in Linux, including Slackware.
- displays a graphic of the system load
- graphical interface to print manager. This is included on one of the XFCE menus, but does not seem to be a part of the base Red Hat distribution.
- list fonts available under the X Window system.
- browsable command reference. Displays manual pages under X.
- graphical front end under X to the nmh mail handling system. This program is part of the XFree86 package in Red Hat.
- utility for modifying keymaps and pointer button mappings in X. Can be used to install a French Canadian keyboard. Download the Xmodmap.cf file from www.linux-quebec.org, and insert the command
xmodmap /etc/X11/Xmodmap.cf &
into the .xession (with xdm) or the .xinitrc (with startx) file.
- displays bar graphs of system load, load average, memory usage, and swap usage
- simple paint program for X
- GPL'd utility for previewing dvi files. Doesn't seem to work too well on texts with a lot of math.
- X Window audio cd player utility
- utility to configure root window of an X terminal
- graphical display of load and memory usage
- start an X Window terminal session
term-color - color version of xterm
- utility for viewing and manipulating many types of image files. This is a shareware program.
- utility for fine tuning of monitor settings under X
- parser generator
- multi-user program similar to talk
- read one or more files that have been compressed with gzip or compress and write to standard output
- read compressed files and pass them to cmp
- read compressed files and pass them to diff
- read compressed files and pass them to grep
- AfterStep button panel module
- zip utility compatible with DOS PKzip
- view zipped files
- print contents of compressed files one screen at a time
- uncompress Z files and recompress in .gz format
If you already have whole bunch of iptables firewall rules, add these at the bottom, which will log all the dropped input packets (incoming) to the /var/log/messages
iptables -N LOGGING
iptables -A INPUT -j LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4
iptables -A LOGGING -j DROP
log dropped packets to syslog in ubuntu, this would be the quickest way:
sudo iptables -I INPUT (5) -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7