Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We have to do our own linux system administration.
I agree, it's a bad idea, we're just developers.
But it's what we are stuck with for now.
Here's our crib sheet.

user admin

adduser -p paSSwoRD aUser
userdel -r aUser

sed

global search and replace

Code Block
sed -e 's/foo/bar/g' myfile.txt

mount

mount a drive

mount -f nfs code:/mnt/data

locate

like find, only better

screen

like nohup and script together in a single package, only better

scp

secure copy

  • example 1
    • scp -i ~/.ssh/id_dsa -r source_dir user@remote_host:/target/path
    • -i: uses identity file (private key) at ~/.ssh/id_dsa
    • -r: recursive
  • example 2
    • scp -i ~/.ssh/id_dsa_uploader filetoupload root@sfgov2.3tera.net:/app/mad_sfmap_images/main.images/root/

simple command lines

Code Block
# lists previous commands
$ history

# executes command number 123 from the shell history
$ !123

# print shared library dependencies
ldd yourFileName

user administration (for root only)

Code Block

# create a new user
$ useradd newuser

# at this point the account is disabled; to enable, set the passwd
[root@gis03v5wiki home]# passwd svnadmin
Changing password for user svnadmin.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

# delete a user
userdel loseruser

setting up snmp

sdfjskldf

command line idioms

Code Block
# find and remove log files
$ find . -name "*.log" | xargs rm

# how many jpeg files are in layer-group_hybrid?
$ find layer-group_hybrid -name "*.jpeg" | wc

# what is the timestamp of youngest file within an entire directory structure?
$ find . -name "*.png" | xargs ls -l | awk '{print $6 " " $7}' | sort | head -1

# what is the timestamp of oldest file within an entire directory structure?
$ find . -name "*.png" | xargs ls -l | awk '{print $6 " " $7}' | sort | tail -1




location location location

http://www.pathname.com/fhs/pub/fhs-2.3.html

...

Your path or even in the path of root may not have these.

if it is broke

Panel

check the permissions

...