Linux Tools
Or useful things about Linux I'm sure to forget...
Troubleshooting high load average
- Use
for printing ascii files. ex. a2ps README.txt. This
will send the file to the default printer. To check a file
first, print to display, e.g. a2ps -P display
README.txt. Change the font size to 6 with -f6
option. Show man pages with man pdiff | a2ps -P
display. a2ps isn't installed on AlmaLinux. Use enscript
-
atom
Use for profiling executables with
hierarchial tracking. ex. atom bmadz_g -tool hiprof
-toolargs="-hiout textout -textout -calltime". Then run
the created executable, e.g. bmadz_g.hiprof, and look
at textout.hiout.
-
awk
A pattern matching programming language.
-
baobab
A graphical display of disk space usage.
-
chgrp
This changes the group ownership of files or
directories. To change the group of a directory and its
subdirectories: chgrp -R groupname dirname. This is
the equivalent of a chown command: chown -R :groupname
dirname
-
convert
A very useful image conversion and
manipulation command line program. For instance: enlarge an
image with convert -geometry 150% bmadz.png bmadz.png,
or rotate 90% by convert -rotate 90 image.png
rotated.png. To convert ps to png, convert -density
100x100 image.ps image.png seems to produce reasonably
sized images.
-
cron
Intro. to cron. Allows repeat execution of programs at
scheduled days and times.
-
cxx
The HP C++ compiler and linker. Here's a HP reference
page. gcc should be used instead.
-
df
reports file system disk space usage. df -a
shows all attached disks, even dummy ones.
-
enscript
a replacement(?) for a2ps. Formatting needs to be specified:
enscript -Ef90 programs/test.f90 to format as Fortran f90. Get possible
formats with enscript --help-highlight
-
find
Find files or directories recursively.
find /nfs/acc/user/mjf7 -daystart -atime -1 -name *tao*
will find any file or directory with tao in it that is newer
than yesterday 00:00.
find . -name \*~ -exec rm {} \; will find all files
ending in ~ in all subdirectories of the current directory and
remove them. The {} is a place holder for the current file
found and bash needs the ; escaped.
For
this and other examples
-
gimp
Gnu Image Manipulation Program
-
gmake
Here's a sample
makefile for a simple C++ program. Note the last target is
to create an implicit rule for creating .o files from .cxx
files. (The predefined standard for C++ source is .cc)
-
jalbum
Creates and maintains web thumbnail pages.
(Needs to be downloaded on unix side. JAC is using on
linux.)
-
ladebug
HP unix and linux debugger. Here's the HP
Page. It is said to be vastly inferior to totalview (see
below)
-
ldd
This prints the shared library dependencies
of a program. Very useful in showing problems with the
LD_LIBRARY_PATH environment variable.
-
lpc
Access the printer spool manager. Give
command status to get a list of printer queues.
-
lynx
text-based web browser. (replaced elinks?)
-
ncdu
NCurses Disk Usage disk utility program.
nice -n 9 ncdu -x ./ will map the disk usage in the current
directory without leaving the filesystem.
-
newgrp
Change current group to a new group.
-
nm
Looks through object files for symbols. You
can look through object libraries for a particular symbol, as
in: nm libsomelib.a | grep some_obscure_symbol. A U
next to the symbol means it is undefined, in other words, there
are calls to it. A T means the symbol is in the text, most
likely meaning that it is defined in that library.
-
nohup
Runs a program ignoring hangups and quits
and logouts.
-
paw and paw++
Physics Analysis Workstation -- a
data manipulation and graphing program. See its online site.
-
renice
Change the priority setting of a process
after it has started. renice 4 -p pid sets a nice
setting of 4 to the process with pid number of pid. Or
use renice 4 -u mjf7 to change all of mjf7's
processes.
-
sed
powerful stream editor.
-
ss
socket statistics. Display and monitor the local
computer's socket information.
Ex. while true ; do sudo ss -tp | grep \\.1\\.10:; done will
loop showing processes using tcp sockets with an IP ending in .1.10:
-
tac
Prints a file in reverse (reverse of cat...)
tac test.txt > test.rev will create the file test.rev
that is the reverse of test.txt.
-
totalview
This is the expensive gui debugger.
Invoke with: totalview bmadz_g -a cons.in
new_bmad_input.
-
tr
Translate characters.
tr '\0' '\n' < /proc/16878/environ to look at the
environment that a process was started with. (From the gospel of DSR).
-
tree
display directory structures as a tree.
-
xfig
Creates and modifies figures. (labels...)
-
xlsfonts
Lists the available x-window fonts.
-
xrdb -query
Lists the current x-window resources.
-
zenity
Pops up different gtk+ dialog displays for use in scripts.
Miscellaneous Info
You can get a list of available node names by going to cesr38 and looking at /etc/hosts -- but perhaps better is host -l lns.cornell.edu
I was able to get rid of an error (size_t) while running configure, by changing the CC environment variable from cc to gcc.
To start a job in unix so that logging out won't stop the job, add >& outputFileName & to the command. This redirects stdout and stderr to the output file and run the job in the background.
Mike Forster