Archive

Archive for January, 2009

Linux Command Library (Man Pages)

January 20th, 2009 No comments

 

Source: http://linux.about.com/od/commands/l/blcmdl.htm

 

Command Manual Sections (Command Categories):

1. Applications
2. System Calls
3. Library Functions
4. Hardware Devices
(more after the ads)

5. Configuration Files
6. Games
7. Overviews
8. System Administration
9. n Commands

Man pages are manuals for functions and usage of commands. Linux commands may vary in syntax and usage from one distribution of Linux to another. The command library here is provided as general references. Use the man command to see how a command is used on your particular computer.

Categories: Linux Commands Tags:

C Shell Commands and What They Do

January 20th, 2009 No comments

 

Source: http://linux.about.com/od/commands/l/blcmds.htm

 

The C shell provides the following built-in commands:

#
Marks a command.

alias
Displays alias.

bg
Resumes job in the background.

break
Resumes execution after the loop.

breaksw
Breaks from a switch command; resumes after the endsw command.

case
Defines a label in a switch command.

cd
Changes directory.

chdir
Changes directory, same as cd.

continue
Continues a loop.

default
Specifies the default case in a switch.

dirs
Displays the directory stack.

echo
Writes arguments to the standard output of the shell.

eval
Evaluates a command.

exec
Executes the command in the current shell.

exit
Exits the shell.

fg
Brings a job in the foreground.

foreach
Specifies a looping control statement and execute a sequence of commands until reaching an end command.

glob
Writes arguments to the standard output of the shell, like the echo command, but without the new line.

goto
Continues execution after the specified label.

hashstat
Displays hash table statistics.

history
Displays the history list.

if
Executes a command if condition met.

jobs
Lists active jobs.

kill
Sends a signal to a process. term (terminate) is the default signal.

limit

Sets or list system resource limits.

login
Logs on.

logout
Logs out.

nice
Changes the priority of commands run in the shell.

nohup
Ignores the hangup signal.

notify

Notifies the user about changes in job status.

onintr
Tells the shell what to do on interrupt.

popd
Pops the top directory off the directory stack and changes to the new top directory.

pushd
Exchanges the top two elements of the directory stack.

rehash
Re-computes the hash table of the contents of the directories in the path shell variable.

repeat

Repeats the execution of a command.

set
Displays or set the value of a shell variable.

setenv
Sets environment variables.

shift
Shifts shell arguments.

source
Reads commands from a script.

stop

Stops a background job.

suspend
Stops the current shell.

switch
Starts a switch.

time
Displays the time used to execute commands.

umask
Shows or set file permissions.

unalias

Removes command alias.

unhash
Disables the internal hash table.

unlimit
Removes limitations on system Resource.

unset
Deletes shell variables.

unsetenv
Deletes environment variables.

wait
Waits for background jobs to complete.

while …end

Executes the commands between the while and matching end statements repeatedly.

@
Displays or set the values of all the shell variables.

Categories: Shell Commands Tags:

Linux / Unix Command: chmod

January 20th, 2009 No comments

 

Source: http://linux.about.com/od/commands/l/blcmdl1_chmod.htm

 

NAME

chmod – change file access permissions

SYNOPSIS

chmod [OPTION]… MODE[,MODE]… FILE
chmod [OPTION]… OCTAL-MODE FILE
chmod [OPTION]… –reference=RFILE FILE

DESCRIPTION

This manual page documents the GNU version of chmod. chmod changes the permissions of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new permissions.

The format of a symbolic mode is `[ugoa...][[+-=][rwxXstugo...]…][,...]‘. Multiple symbolic operations can be given, separated by commas.

A combination of the letters `ugoa’ controls which users’ access to the file will be changed: the user who owns it (u), other users in the file’s group (g), other users not in the file’s group (o), or all users (a). If none of these are given, the effect is as if `a’ were given, but bits that are set in the umask are not affected.

The operator `+’ causes the permissions selected to be added to the existing permissions of each file; `-’ causes them to be removed; and `=’ causes them to be the only permissions that the file has.

The letters `rwxXstugo’ select the new permissions for the affected users: read (r), write (w), execute (or access for directories) (x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), sticky (t), the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file’s group (g), and the permissions granted to users that are in neither of the two preceding categories (o).

A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file’s group, with the same values; and the fourth for other users not in the file’s group, with the same values.

chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

STICKY FILES

On older Unix systems, the sticky bit caused executable files to be hoarded in swap space. This feature is not useful on modern VM systems, and the Linux kernel ignores the sticky bit on files. Other kernels may use the sticky bit on files for system-defined purposes. On some systems, only the superuser can set the sticky bit on files.

STICKY DIRECTORIES

When the sticky bit is set on a directory, files in that directory may be unlinked or renamed only by root or their owner. Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on directories, such as /tmp, that are world-writable.

OPTIONS

Change the mode of each FILE to MODE.

-c, –changes
like verbose but report only when a change is made
-f, –silent, –quiet
suppress most error messages
-v, –verbose
output a diagnostic for every file processed
–reference=RFILE
use RFILE’s mode instead of MODE values
-R, –recursive
change files and directories recursively
–help
display this help and exit
–version
output version information and exit

Each MODE is one or more of the letters ugoa, one of the symbols +-= and one or more of the letters rwxXstugo.

SEE ALSO

The full documentation for chmod is maintained as a Texinfo manual. If the info and chmod programs are properly installed at your site, the command

info chmod

should give you access to the complete manual.

Categories: Linux Commands Tags:

Linux / Unix Copy command

January 20th, 2009 No comments

 

Source:  http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=c/cp 

 

cp

cp [options] file1 file2 cp [options] files directory

Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).

Options

-a, –archive

Preserve attributes of original files where possible. The same as -dpr.

-b, –backup

Back up files that would otherwise be overwritten.

-d, –no-dereference

Do not dereference symbolic links; preserve hard-link relationships between source and copy.

-f, –force

Remove existing files in the destination.

-i, –interactive

Prompt before overwriting destination files. On most systems, this flag is turned off by default except for the root user, who is normally prompted before overwriting files.

-l, –link

Make hard links, not copies, of nondirectories.

-p, –preserve

Preserve all information, including owner, group, permissions, and timestamps.

-P, –parents

Preserve intermediate directories in source. The last argument must be the name of an existing directory. For example, the command:

cp –parents jphekman/book/ch1 newdir

copies the file jphekman/book/ch1 to the file newdir/jphekman/book/ch1, creating intermediate directories as necessary.

-r, -R, –recursive

Copy directories recursively.

-S backup-suffix, –suffix=backup-suffix

Set suffix to be appended to backup files. This may also be set with the SIMPLE_BACKUP_SUFFIX environment variable. The default is ~. You need to explicitly include a period if you want one before the suffix (for example, specify .bak, not bak).

-s, –symbolic-link

Make symbolic links instead of copying. Source filenames must be absolute.

–sparse=[always|auto|never]

Handle files that have "holes" (are defined as a certain size but have less data). always creates a sparse file, auto creates one if the input file is sparse, and never creates a non-sparse file without holes.

-u, –update

Do not copy a file to an existing destination with the same or newer modification time.

-v, –verbose

Before copying, print the name of each file.

-V type, –version-control=type

Set the type of backups made. You may also use the VERSION_CONTROL environment variable. The default is existing. Valid arguments are:

t, numbered

Always make numbered backups.

nil, existing

Make numbered backups of files that already have them; otherwise, make simple backups.

never, simple

Always make simple backups.

-x, –one-file-system

Ignore subdirectories on other filesystems.

Example

Copy the contents of the guest directory recursively into the /archives/guest/ directory, and display a message for each file copied:

cd /archives && cp -av /home/guest guest

Categories: Linux Commands Tags:

An A-Z Index of the Bash command line for Linux

January 20th, 2009 No comments

 

Source: http://www.ss64.com/bash

 

a  alias    Create an alias
  apropos  Search Help manual pages (man -k)
  apt-get  Search for and install software packages (Debian)
  aspell   Spell Checker
  awk      Find and Replace text, database sort/validate/index
b
  bash     GNU Bourne-Again SHell
  bc       Arbitrary precision calculator language
  bg       Send to background
  break    Exit from a loop
  builtin  Run a shell builtin
  bzip2    Compress or decompress named file(s)
c
  cal      Display a calendar
  case     Conditionally perform a command
  cat      Display the contents of a file
  cd       Change Directory
  cfdisk   Partition table manipulator for Linux
  chgrp    Change group ownership
  chmod    Change access permissions
  chown    Change file owner and group
  chroot   Run a command with a different root directory
  chkconfig System services (runlevel)
  cksum    Print CRC checksum and byte counts
  clear    Clear terminal screen
  cmp      Compare two files
  comm     Compare two sorted files line by line
  command  Run a command - ignoring shell functions
  continue Resume the next iteration of a loop
  cp       Copy one or more files to another location
  cron     Daemon to execute scheduled commands
  crontab  Schedule a command to run at a later time
  csplit   Split a file into context-determined pieces
  cut      Divide a file into several parts
d
  date     Display or change the date & time
  dc       Desk Calculator
  dd       Convert and copy a file, write disk headers, boot records
  ddrescue Data recovery tool
  declare  Declare variables and give them attributes
  df       Display free disk space
  diff     Display the differences between two files
  diff3    Show differences among three files
  dig      DNS lookup
  dir      Briefly list directory contents
  dircolors Colour setup for `ls'
  dirname  Convert a full pathname to just a path
  dirs     Display list of remembered directories
  dmesg    Print kernel & driver messages
  du       Estimate file space usage
e
  echo     Display message on screen
  egrep    Search file(s) for lines that match an extended expression
  eject    Eject removable media
  enable   Enable and disable builtin shell commands
  env      Environment variables
  ethtool  Ethernet card settings
  eval     Evaluate several commands/arguments
  exec     Execute a command
  exit     Exit the shell
  expect   Automate arbitrary applications accessed over a terminal
  expand   Convert tabs to spaces
  export   Set an environment variable
  expr     Evaluate expressions
f
  false    Do nothing, unsuccessfully
  fdformat Low-level format a floppy disk
  fdisk    Partition table manipulator for Linux
  fg       Send job to foreground
  fgrep    Search file(s) for lines that match a fixed string
  file     Determine file type
  find     Search for files that meet a desired criteria
  fmt      Reformat paragraph text
  fold     Wrap text to fit a specified width.
  for      Expand words, and execute commands
  format   Format disks or tapes
  free     Display memory usage
  fsck     File system consistency check and repair
  ftp      File Transfer Protocol
  function Define Function Macros
  fuser    Identify/kill the process that is accessing a file
g
  gawk     Find and Replace text within file(s)
  getopts  Parse positional parameters
  grep     Search file(s) for lines that match a given pattern
  groups   Print group names a user is in
  gzip     Compress or decompress named file(s)
h
  hash     Remember the full pathname of a name argument
  head     Output the first part of file(s)
  history  Command History
  hostname Print or set system name
i
  id       Print user and group id's
  if       Conditionally perform a command
  ifconfig Configure a network interface
  ifdown   Stop a network interface
  ifup     Start a network interface up
  import   Capture an X server screen and save the image to file
  install  Copy files and set attributes
j
  join     Join lines on a common field
k
  kill     Stop a process from running
  killall  Kill processes by name
l
  less     Display output one screen at a time
  let      Perform arithmetic on shell variables
  ln       Make links between files
  local    Create variables
  locate   Find files
  logname  Print current login name
  logout   Exit a login shell
  look     Display lines beginning with a given string
  lpc      Line printer control program
  lpr      Off line print
  lprint   Print a file
  lprintd  Abort a print job
  lprintq  List the print queue
  lprm     Remove jobs from the print queue
  ls       List information about file(s)
  lsof     List open files
m
  make     Recompile a group of programs
  man      Help manual
  mkdir    Create new folder(s)
  mkfifo   Make FIFOs (named pipes)
  mkisofs  Create an hybrid ISO9660/JOLIET/HFS filesystem
  mknod    Make block or character special files
  more     Display output one screen at a time
  mount    Mount a file system
  mtools   Manipulate MS-DOS files
  mv       Move or rename files or directories
  mmv      Mass Move and rename (files)
n
  netstat  Networking information
  nice     Set the priority of a command or job
  nl       Number lines and write files
  nohup    Run a command immune to hangups
  nslookup Query Internet name servers interactively
o
  open     Open a file in its default application
  op       Operator access
p
  passwd   Modify a user password
  paste    Merge lines of files
  pathchk  Check file name portability
  ping     Test a network connection
  popd     Restore the previous value of the current directory
  pr       Prepare files for printing
  printcap Printer capability database
  printenv Print environment variables
  printf   Format and print data
  ps       Process status
  pushd    Save and then change the current directory
  pwd      Print Working Directory
q
  quota    Display disk usage and limits
  quotacheck Scan a file system for disk usage
  quotactl Set disk quotas
r
  ram      ram disk device
  rcp      Copy files between two machines
  read     read a line from standard input
  readonly Mark variables/functions as readonly
  reboot   Reboot the system
  renice   Alter priority of running processes
  remsync  Synchronize remote files via email
  return   Exit a shell function
  rev      Reverse lines of a file
  rm       Remove files
  rmdir    Remove folder(s)
  rsync    Remote file copy (Synchronize file trees)
s
  screen   Multiplex terminal, run remote shells via ssh
  scp      Secure copy (remote file copy)
  sdiff    Merge two files interactively
  sed      Stream Editor
  select   Accept keyboard input
  seq      Print numeric sequences
  set      Manipulate shell variables and functions
  sftp     Secure File Transfer Program
  shift    Shift positional parameters
  shopt    Shell Options
  shutdown Shutdown or restart linux
  sleep    Delay for a specified time
  slocate  Find files
  sort     Sort text files
  source   Run commands from a file `.'
  split    Split a file into fixed-size pieces
  ssh      Secure Shell client (remote login program)
  strace   Trace system calls and signals
  su       Substitute user identity
  sudo     Execute a command as another user
  sum      Print a checksum for a file
  symlink  Make a new name for a file
  sync     Synchronize data on disk with memory
t
  tail     Output the last part of files
  tar      Tape ARchiver
  tee      Redirect output to multiple files
  test     Evaluate a conditional expression
  time     Measure Program running time
  times    User and system times
  touch    Change file timestamps
  top      List processes running on the system
  traceroute Trace Route to Host
  trap     Run a command when a signal is set(bourne)
  tr       Translate, squeeze, and/or delete characters
  true     Do nothing, successfully
  tsort    Topological sort
  tty      Print filename of terminal on stdin
  type     Describe a command
u
  ulimit   Limit user resources
  umask    Users file creation mask
  umount   Unmount a device
  unalias  Remove an alias
  uname    Print system information
  unexpand Convert spaces to tabs
  uniq     Uniquify files
  units    Convert units from one scale to another
  unset    Remove variable or function names
  unshar   Unpack shell archive scripts
  until    Execute commands (until error)
  useradd  Create new user account
  usermod  Modify user account
  users    List users currently logged in
  uuencode Encode a binary file
  uudecode Decode a file created by uuencode
v
  v        Verbosely list directory contents (`ls -l -b')
  vdir     Verbosely list directory contents (`ls -l -b')
  vi       Text Editor
  vmstat   Report virtual memory statistics
w
  watch    Execute/display a program periodically
  wc       Print byte, word, and line counts
  whereis  Report all known instances of a command
  which    Locate a program file in the user's path.
  while    Execute commands
  who      Print all usernames currently logged in
  whoami   Print the current user id and name (`id -un')
  Wget     Retrieve web pages or files via HTTP, HTTPS or FTP
  write    Send a message to another user
x
  xargs    Execute utility, passing constructed argument list(s)
  yes      Print a string until interrupted
  .        Run a command script in the current shell
  ###      Comment / Remark
Categories: Linux Commands Tags:

Linux / Unix mkdir command

January 20th, 2009 No comments

 

Source : http://www.computerhope.com/unix/umkdir.htm

 

About mkdir

Short for make directory this command is used to create a new directory.

Syntax

mkdir dirname

dirname
The name of the directory that you wish to create.

Examples

mkdir mydir – This would create a new directory called mydir.

 

 

Source : http://www.ss64.com/bash/mkdir.html 

 

mkdir

Create new folder(s), if they do not already exist.

SYNTAX
      mkdir [Options] folder...

      mkdir "Name with spaces"

OPTIONS
  -m, --mode=MODE   set permission mode (as in chmod), not rwxrwxrwx - umask
  -p, --parents     no error if existing, make parent directories as needed
      --verbose     print a message for each created directory

 

mkdir creates the standard entries . (dot) for the current folder

and .. (dot dot) for its parent

Any folder name that includes spaces may appear in some applications

as "Name%20with%20spaces"

Categories: Linux Commands Tags: