Unix Command Line Concepts
Unix Command Line Concepts
concepts
Jan 24, 2012 Juche 101
Artem Nagornyi
Chapter 1
$ ln -s /usr/local/ff/firefox /usr/bin/firefox
$ ln /usr/local/ff/firefox /usr/bin/firefox
Some other characters can be also supported, but they are not
recommended to use.
4.3 Getting help
$ ls -l
● The left group of 3 gives the file
permissions for the user that owns the Owner of the
file
Size
Modification
date
file (or directory) (artem in the above
example). File -rw-rw-r-- 1 artem softserve 83 Feb 3 1995 myfile
permissions
● The middle group of 3 gives the
permissions for the group of people to Number of
Group of
subdirectories (1 Filename
whom the file (or directory) belongs for a file)
the owner
The symbol in the beginning of the string indicates whether this is a file, directory or a
link:
'd' indicates a directory, '-' indicates a file, 'l' indicates a symbolic link.
The permissions r, w, x (read, write, execute) have slightly different meanings depending
on whether they refer to a simple file or to a directory.
...
So, in order to read a file, you must have execute permission on the directory containing
that file, and hence on any directory containing that directory as a subdirectory, and so on,
up the tree.
Also file can be written if its permissions allow Write, but it can only be deleted if its
directory's permissions allow Write.
5.2 Changing access rights
The other way to use the chmod command is the absolute form. In this
case, you specify a set of three numbers that together determine all
the access classes and types. Rather than being able to change only
particular attributes, you must specify the entire state of the file's
permissions.
The three numbers are specified in the order: user (or owner), group,
other. Each number is the sum of values that specify: read (4), write
(2), and execute (1) access, with 0 (zero) meaning no access. For
example, if you wanted to give yourself read, write, and execute
permissions on myfile; give users in your group read and execute
permissions; and give others only execute permission, the appropriate
number would be calculated as (4+2+1)(4+0+1)(0+0+1) for the three
digits 751. You would then enter the command as:
chmod 751 myfile
5.2.1 Changing owner of the file
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
...
This command lists all currently running processes in the system.Output columns (this is
Linux, output on other Unixes may slightly differ):
$ find . -name "*.txt" -print Searches for all files with the
extension .txt, starting at the
current directory (.) and
working through all sub-
directories, then printing the
name of the file to the screen
(simple output).
$ mkdir mydir
$ sudo mount -t vfat /dev/sdc1 mydir
$ umount mydir
$ mkdir alpha
$ sudo mount -t smbfs //alpha.softservecom.com/install alpha
-o username=yourusername,password=yourpassword
$ crontab -e
This command opens crontab file where you can schedule commands
execution. (use sudo if you need the command to be executed with
root permissions)
Example:
01 04 1 1 1 /usr/bin/somedirectory/somecommand
An asterisk (*) can be used so that every instance (every hour, every
weekday, every month, etc.) of a time period is used. Example:
01 04 * * * /usr/bin/somedirectory/somecommand