Linux Command
Linux Command
Presented by:
Victor Gedris
In Co-Operation With:
The Ottawa Canada Linux Users Group
and
ExitCertified
Copyright and Redistribution
This manual was written with the intention of being a helpful guide to Linux users who are trying
to become familiar with the Bash shell and basic Linux commands. To make this manual useful to
the widest range of people, I decided to release it under a free documentation license, with the
hopes that people benefit from it by updating it and re-distributing modified copies. You have
permission to modify and distribute this document, as specified under the terms of the GNU Free
Documentation License. Comments and suggestions for improvement may be directed to:
[email protected].
This document was created using an Open Source office application called Open Office. The file
format is non-proprietary, and the document is also published in various other formats online.
Updated copies will be available on Vic Gedris' web site [http://vic.dyndns.org/]. For
more information on Open Office, please visit http://www.openoffice.org/.
Command Syntax
Commands can be run by themselves, or you can pass in additional arguments to make them do
different things. Typical command syntax can look something like this:
command [-argument] [-argument] [--argument] [file]
Examples: ls List files in current directory
ls -l Lists files in “long” format
ls -l --color As above, with colourized output
cat filename Show contents of a file
cat -n filename Show contents of a file, with line numbers
2.0 Getting Help
When you're stuck and need help with a Linux command, help is usually only a few keystrokes
away! Help on most Linux commands is typically built right into the commands themselves,
available through online help programs (“man pages” and “info pages”), and of course online.
Linux Description
Command
which Shows the full path of shell commands found in your path. For example, if
you want to know exactly where the “grep” command is located on the
filesystem, you can type “which grep”. The output should be something
like: /bin/grep
whereis Locates the program, source code, and manual page for a command (if all
information is available). For example, to find out where “ls” and its man
page are, type: “whereis ls” The output will look something like:
ls: /bin/ls /usr/share/man/man1/ls.1.gz
locate A quick way to search for files anywhere on the filesystem. For example, you
can find all files and directories that contain the name “mozilla” by typing:
locate mozilla
find A very powerful command, but sometimes tricky to use. It can be used to
search for files matching certain patterns, as well as many other types of
searches. A simple example is:
find . -name \*mp3
This example starts searching in the current directory “.” and all sub-
directories, looking for files with “mp3” at the end of their names.
A terminal is a “device” that is used for entering data into, and displaying data from, a
computer.
A terminal emulator is a “window” that presents the user a command line interface (CLI).
Once you open a terminal emulator the user communicate through the CLI with a
program called the shell.
If you are curious about the colors available you can use the command:
showrgb | less
Shell
Software that provides an interface for users to “pass” commands to the Operating
System.
Bourne Shell: sh
C Shell: csh
Bourne Again Shell: bash
Korn Shell: ksh
Enhanced (TENEX) C Shell: tcsh
Running Programs
Page 1 of 13
Getting Help
<command> --help
man <command>
info <command>
man man
man intro
ssh -X <username>@<ip-address>
Page 2 of 13
Display kernel message log dmesg dmesg
Display name of computer hostname hostname
Display jobs running in jobs jobs
background
Kill specified process kill kill <processID>
Display running processes ps ps aux
Page 3 of 13
Print version information for lsb_release lsb_release -a
the Linux release you are
running
Print effective user id whoami whoami
Shows who is logged on who who
Change the permissions on chmod example:
the files/directory listed chmod ug+x fil*
Change owner and group on chown chown <ownername>[:groupname] <file...>
the files/directory listed
Change group ownership on chgrp example:
the files/directories listed chgrp -hR groupname /dirname
File Permissions
-rwxr-x--x
Useful Tricks
Page 4 of 13
Miscellaneous on Ubuntu Linux
Install Updates
• System > Administration > Synaptic Package Manager > Settings > Repositories
OR
• System > Administration > Software Sources
• Type: ALT + F2
Page 5 of 13
Install the cshell (or the tcshell)
Available Repositories:
• Main (all packages included by default. These packages have Official Support)
• Restricted (packages with restricted copyright)
• Backports (newer versions of packages in the archive)
• Universe (all packages mantained by the Ubuntu Community)
• Multiverse (packages not free(dom))
Selecting Repositories from which getting packages:
• vi /etc/apt/sources.list
• Uncomment the repositories you want to have available
Page 6 of 13
Listing Files owned by a Package
• dpkg -L mypackage
Finding which Package owns a File
• dpkg -S myfle
Finding which package provides a file
• apt-file search myfle
apt-file is part of the universal repository
Page 7 of 13
Appendix A
NOTE:
If you attempt to install Windows on a hard disk that has Ubuntu, Windows will
overwrite Ubuntu.
Pre-installation Steps
NOTE: Ubuntu needs at least 3GB of free space (the base installation takes 2GB),
more if we plan to install a lot of programs
Installation Steps
Page 8 of 13
Step 2: Boot from the DVD-ROM
Make sure the BIOS setup program has the CD-ROM Drive in the Boot Sequence before
the main Hard Disk.
Step 10. Import Documents and Settings of existing accounts from your
Windows Partition
Page 9 of 13
Sep 11. Confirm Installation Choices
Page 10 of 13
Appendix B
If not yet installed add the following application programs to your machine:
• csh
Many application programs require you to run one or more C shell scripts to get installed,
so sooner or later you'll need to have the C shell available on your system.
• openssh-server
This package provides secure remote access to your computer. It allows you to
securely connect to your machine in the lab from a remote computer.
• WineHQ
This program allows you to run windows application programs on your Linux
machine
• LTspice/SwtitcherCADIV
This program is a complete and fully functional high performance Spice III simulator,
schematic capture and waveform viewer provided for free by Linear Technology
• Electric VLSI System
Free Electronic Design Automation (EDA) system for IC design (schematics, layout,
DRC, LVS, ERC, etc.).
Page 11 of 13
Appendix C
This makes the installation of ngspice a little more difficult. Whenever an application
does not come in a distribution package we have to compile the source code of the
application.
Although the process is usually quite simple, it may require a good dose of patience. This
is due to the fact that, quite often, before you can successfully install and run the
application you are interested in you are expected to install a number of supporting
applications and libraries (that nobody bothered to mention).
If the compilation process fails do not get discouraged just read carefully the error
messages, install the missing libraries and application programs and try again. The
process may take several trials before you succeed, so be patient
Installation Steps
Step 1.
sudo mkdir –p /opt-u/CAD
cd /opt-u/CAD
Step 4.
cd ng-spice-rework-17
Make sure you have all of them installed before you continue.
aclocal
./autogen.sh
./configure --enable-xgraph
make
sudo make install