FreeBS Free BSD D command com mand reference Command structure Each Each line line you type at the Unix shell shell consists consists of a command optionally followed followed by some arguments , e.g. ls -l /etc/passwd | | | cmd arg1
arg2
Almost lmost all all commands are just programs programs in the file filesys system, tem, e.g. e.g. "ls" "ls" is actuall actually y /bin/ls. A few are built- in to the shell. All All commands commands and file filenames names are are case-sensitive . Unless Unless told otherwise, otherwise, the command will will run in the "foreg "foreground" round" - that is, you won't be returned to the shell prompt until it has finish finished. ed. You can can press Ctrl + C to terminate it. it.
Colour code command [args... args...] ]
Command which which shows information
command [args... args...] ]
Command which which modifies your your current session session or system system settings, settings, but changes will will be be lost lost when you exit exit your shell or reboot
command [args... args...] ]
Command which which permanently affects the state of your system
Getting out of trouble ^C
(Ctrl-C)
Terminate Terminate the current current command
^U
(Ctrl-U)
Clear Clear to start of line
stty sane
Reset Reset terminal settings. settings. If in xterm, xterm, try Ctrl+ Ctrl+Middle Middle mou se button and select select "Do Full Reset" Reset"
exit
Exit Exit from from the shell
reset
logout ESC :q! ENTER
Quit from vi without without saving saving
Finding documentation
man -a cmd
Show Show manual page page for for command "cmd". "cmd". If a page with with the same name exists exists in multiple multiple sections, sections, you can give give the section section numbe r, or -a to show pages from all all sections. sections.
man -k str
Search Search for string"str" string"str" in the manual index
man hier
Description Description of directory directory structure
cd /usr/share/doc; ls
Brows Browsee system system documentation and examples examples.. Note especi especial ally ly
man cmd man 5 cmd
cd /usr/share/examples; ls cd /usr/local/share/doc; ls
/usr/share/doc/en/books/handbook/index.html
Brows Browsee packag packagee documentation and examples examples
cd /usr/local/share/examples On the web: www.freebsd.org
Includes Includes handboo k, searchable mailing mailing list list archives archives
System status Alt-F1 ... Alt-F8
Switch Switch between virtual virtual consoles
date
Show Show current current date and time
ntpdate -b serv1 serv2 ...
Synchronise clock clock to given NTP server(s)
uptime
Display Display time since last last reboot and load stats
w
Show who is currently currently logged logged in
last -10
Show last 10 logins logins
Directories pwd
Show current directory directory ("print ("print working working directory")
cd subdir
Move Move into a subdirectory of the current directory directory
cd ..
Move Move up one level, level, to the parent directory directory
cd /
Change current directory: directory: to the files filesystem ystem root, to an absolute locat location, ion, to a particul particular ar user's user's home direct directory, ory, or to your own home direct directory ory
cd /absolute/path cd ~username ~username cd ls
List ist contents of current current directory directory or given given directory directory
ls path ls -l
List List directory in long form (lowercas (lowercasee 'L', 'L', not num ber one)
ls -a
List all files files,, including hidden files files
ls -d
List directory itsel itself, f, rather than its contents
ls -ld path
Example of combining flags flags
mkdir path
Create Create a directory
rmdir path
Delete Delete an empty direct directory ory
rm -rf subdir
Recursi Recursivel vely y delete a directory and all all its contents - DANGEROUS!
Files file filename less filename
Read first few bytes bytes of file file and guess its type Read Read contents of fil filee in pager. space = next page, b = previous previous page, q = quit quit / = search search forward, forward, ? = search search backwards, backwards, n = repeat search search
less -Mi filename
filename , -i = case-insensitive searching searching -M = show filename
grep [-i] pattern filename
Show all all lines lines which contain the given given pattern; -i = caseinsensitive
wc -l filename
Count lines lines in file file (lowercase 'L', 'L', not one)
head -num -num filename
Show first/last nu m lines of file; file; defaults to 10 lines
tail -num -num filename tail -f filename
Show last last 10 lines lines of fil filee then wait wait and show new lines lines as they are added (^C to exit). exit). Especially Especially useful for log files. files.
strings filename | less
Extract xtract printable text text strings from a binary file
touch filename
Create Create file file if it does not exist exist,, or update its timestamp
rm filename
Delete (remove) file
cp filename newname
Copy one file file
cp file1 file2 ... subdir subdir/ /
Copy a file file or files files into into another directory. directory. (The trailing trailing slash on the subdir is not essential, essential, but prevents errors when you are copying copying one file file and 'subdir' 'subdir' does not exis exist) t)
mv oldname newname
Rename Rename one file file or directory directory
mv file1 file2 ... subdir subdir/ /
Move Move a file file or files files into another directory directory
ln filename newname
Make Make a hard link from file file to newname (both (both names point point to the same filesys filesystem tem inode). Both Both name s must be on same file filesys system. tem.
ln -s path newname
Make Make newname newname a symbolic or soft link pointing pointing to path , which which may be a file file or directory directory and can be anywhere on the file filesys system. tem.
Searching for files locate str
Search Search for for filenames filenames matching str in the locate locate databas e
/etc/periodic/weekly/310.locate
Rebuild Rebuild the locate locate databas e
find path -type f
Find Find all all file filess under the given given path (use "." for for current directory) directory)
find path -type f -name 'foo*'
Find Find all all fil files es under the given given path whose name begins "foo" "foo"
find path -type f | xargs cmd
Find Find all all fil files es under path and apply cm d to each of them them
find path -type f -print0 | xargs -0 cmd
Safer Safer version version of above above (works (works with filenames filenames that contain spaces) spaces)
Compressed files and archives Read Read compr essed text text file file,, without without uncomp ressing it on disk
gzip -dc filename filename.gz .gz | less bzip2 -dc filename filename.bz2 .bz2 | less tar -tzf filename filename.tgz .tgz
Show Show contents of compressed tar archive. archive. Add Add - v for for more detail
or .tar.gz
tar -tjf filename filename.tbz2 .tbz2 or .tar.bz2
tar -xvjf [-C dir dir] ] filename filename.tbz2 .tbz2
Extrac Extractt contents of compressed compressed archive archive [into specified specified directory, directory, otherwise into current directory] directory]
nroff -mandoc foo.1 | less
Format Format a man page page file file
tar -xvzf [-C dir dir] ] filename filename.tgz .tgz
Processes ps auxw
Show all processes
ps auxw | grep procname
Show Show all proce processes sses matching pattern pattern "procname" "procname" (note (note that "grep procname" procname" itse itself lf may be shown) shown)
top
Show Show continuously the most activ activee processe processess ( q to quit)
kill pid
Send Send a 'terminate' signa signall to the given given process: process: requests process process to clean clean up quickly quickly and exit exit
kill -TERM pid
Send Send a 'hangup' signa signall to the given given process: process: some processes processes use this as a request to re-read their config file files. s. (one, not letter letter 'L')
kill -1 pid kill -HUP pid
kill -KILL pid
Send a 'kill' 'kill' signal signal to the given given process: the process is killed killed immediately and cannot clean clean up first. first. Use only as a last last resort.
killall [-1|-9] procname
Send signal signal to all processes whose nam e is "procname"
kill -9 pid
Account customisations ~/.profile
EDITOR=joe; ex export ED EDITOR
Change Change your your default default editor and pager pager
PAGER=less; export PAGER
PS1='[\u@\h \W]\$ '; export PS1
bash bash prompt which which displ displays ays your your current current username, username, host, host, and direct directory ory
~/.netrc
default login ftp password user@site
Make Make ftp client client login login automatically
~/.xinitrc
exec startkde
Choose 'kde' desktop
~/.b ~/.ba ash_p sh_pro rofi file le
. .pro .profi file le
X Window System startx
Start Start graphical environmen t
Ctrl-Alt-F1 ... Alt-F9
Switch Switch to text text console while while in X; return to X
Ctrl-Alt-Backspace
Emergency Emergency exit exit from X
xterm -sb -sl 500 -ls
Run xterm xterm with 500 lines lines of scroll scrollback back (much better than Konsole Konsole))
xset b off
Disable Disable terminal beep in X environme environme nt
Shell facilities which foo
Search Search for comman d foo in PATH PATH and show where it was found
history 20
Displ Display ay the 20 most most recentl recently y entered entered commands
!num
Re-exe Re-execute cute comman d nu m from from history history
cmd1; cmd1 ; cmd2
Run cmd1 followed followed by cmd2
cmd1 && cmd2
Run cmd1 , then cmd2 only if cmd1 was succ essful ($? = 0)
Argument expansion /home/yourname/ /file or /home/user /home/user/file /file Expands Expands to /home/yourname
~/file ~user user/file /file /somepath somepath/*.txt /*.txt
Expands Expands to all filenames filenames matching that pattern. * matches any characters; ? matches any one char; [abc] [abc] matches only those those characters; [a-z] [a-z] matches matches any in that range.
$var
Substitute Substitute value value of environme environme nt variable variable 'var'
The special special meaning of characters characters (including (including space which normally separates arguments) can be removed by csh . preceeding them with with a backslash; backslash; or by "quoting" "quoting" or 'quoting' the whole argument. See m a n sh or man csh
Environment printenv
Show Show all all environme environme nt variables variables
printenv PATH
Show Show single environme environme nt variabl variablee `PATH '
echo $PATH foo="value"; export foo
[sh]
setenv foo "value"
[csh]
unset foo
[sh]
unsetenv foo
[csh]
Set Set environment variable variable `foo' Unset Unset environment environment varia variable ble `foo'
Envir Environment onment variables variables can be set at login login time in ~/.profile [sh], ~/.bash_profile [bash], or ~/.cshrc [csh]
File redirection ^D
Send Send end- of-fi of-file le on standard input
(Ctrl-D)
cmd1 | cmd2
Pipe Pipe output of cmd1 to input of cmd2
cmd >out.txt
Redi Redirect rect command standard standard output to file file
cmd 2>err.txt
[sh]
Redi Redirect rect command error error output to file file
cmd >out.txt 2>&1
[sh]
Redi Redirect rect both standard standard and error error output to file file
cmd >&out.txt
[csh]
cmd >>out.txt
Append Append to out.txt instead of replacing replacing it
cmd
Redi Redirect rect command standard standard input from file file
Job control ^C
(Ctrl-C)
Terminate Terminate current current foreg foreground round process process
^Z
(Ctrl-Z)
Suspend Suspend current current foreg foreground round process process (makes (makes suspended suspended job) job)
jobs
List List jobs under this shell
kill %n
Terminate Terminate job number n
fg
Restart Restart suspended process in foreground foreground
fg %n bg
Restart Restart suspended process in background background
bg %n cmd &
Start Start command as back background ground job
'vi' editor This This is the standard Unix Unix editor and is alway alwayss available available.. You must be extremely careful careful though, because the effe effect ct of hitting hitting a key key will will depend depend on what mode you are in at that time. time. If in any doubt, hit ESC ESC to to get back to command mode, then enter one of the commands commands shown shown here. here. :q!
[Enter]
Quit Quit without without saving saving
:wq
[Enter]
Write Write and quit
:wq! [Enter]
Write Write and quit, forcing forcing overwrite overwrite of read- only file file
:w filename [Enter]
Write Write out to a different different file file
^L
Redraw screen
(Ctrl-L)
^
Move Move to start of line line
$
Move Move to end of line line
h j k l
Move Move cursor cursor left left / down / up / right right (alternat (alternative ive to cursor cursor keys) keys)
:num
Go to line line numb er nu m
[Enter]
Go to last line
G /pattern
[Enter]
Search Search forwards forwards for for pattern
?pattern
[Enter]
Search Search backwards backwards for for pattern
n
Repeat last search
i text ESC
Insert text before cursor position position
A text ESC
Append Append text text after end of line line
o text ESC
Open Open new line line after after current current one and insert insert text
x
Delete Delete character character under cursor cursor
r char
Replace Replace character under cursor with another single single character
dd
Delete Delete entire line line
yy
Copy current line line ("yank") ("yank")
num yy
Copy nu m lines, lines, starting starting with the current line line
p
Paste copy buffer buffer after current line line
'ee' editor This This is a simpler alternative to 'vi' 'vi' and is install installed ed as part of the FreeBSD FreeBSD base system. system. However However it may not alway alwayss be available available (there is /rescue/vi for for emergenci emergencies es when when /usr is not not mounted, but no emergenc emergency y 'ee' 'ee' ). You don't don't need to remember anything in this table; table; all all commands are described described on-screen. ESC
Pop-up Pop-up menu
^C
Command Command prompt prompt
^C quit
[Enter]
Quit Quit without without saving saving
^C exit
[Enter]
Write Write and quit
^C write [Enter]
Write Write out to a different different file file
^A
Move Move to start of line line
^E
Move Move to end of line line
^C num
[Enter]
Go to line line numb er nu m
^Y string
[Enter]
Search Search forwards forwards for for string string
^X
Repeat last search
^K
Delete Delete entire line line
'joe' editor 'joe' 'joe' is a powerfu powerfull editor and a lot more forgi forgiving ving than 'vi', 'vi', but needs to be installed installed as a separate separate package package and may not alway alwayss be availab available. le. You can can get away away with with knowing knowing only ^K X, X, and even even that is shown in the on-screen help! help! ^K H
(Ctrl-K, H)
Toggl Togglee help on/off
^C
Quit Quit without without saving saving
^K X
Write Write and quit
^K D
Write Write (optionally to a different different filename) filename) without without quitting
^R
Redraw screen
^T T
Toggl Togglee insert/overwrite mode
^A
Move Move to start of line line (or use 'Home')
^E
Move Move to end of line line (or use 'End')
^K L num
[Enter]
Got to last last line line
^K V ^K F pattern
Go to line line numb er nu m
[Enter]
Search Search for pattern; gives gives options for for backwards and replace
^L
Repeat last search
^Y
Delete Delete entire line line
^_
Undo (on some terminals, Ctrl-Shi Ctrl-Shift-Underscore ft-Underscore is required)
^K B
Mark start of block block
^K K
Mark Mark end of block block
^K C
Copy block block to current cursor position
^K M
Move Move block to current cursor position
^K Y
Delete block
^K W
Write Write block to a file file
^K R
Insert file file at current cursor position
You can can get alternative alternative key bindings bindings by invoking invoking as 'jmacs', 'jstar' or 'jpico' 'jpico' which which correspond correspond to emacs, WordStar WordStar and pico respectively.
System Administration User accounts id
Show Show current uid, uid, gid gid and supplementary supplementary groups groups
whoami
Show Show current current username username only only
su
Change Change uid to root (note: user user must be in "wheel" group) group)
su username
Change Change uid to username
su -
As above, but also also reinitialise reinitialise environmen t as per a full full login login
su - username cat /etc/passwd
Show all account s
cat /etc/group
Show all groups
pw useradd username -m
Create Create user; -m = make make home director directory y
passwd
Set or or change password for self self or for another account account (root only)
passwd username pw usermod username -G wheel
Add user to "wheel "wheel"" group group (or (or just edit /etc/group direct directly ly))
pw userdel username -r
Delete Delete user; -r = remove hom e directory directory and all all its its contents
cat /etc/master.passwd
Show all all accounts accounts (including (including encrypted passwords) passwords)
vipw
Lock Lock master.passwd, master.passwd, edit it, and and rebuild password databases
Filesystems mount
Show mounte d file filesys systems tems
df
Show used and free free space in all mounte d file filesys systems tems (-h = "huma n
df -h
readable", e.g. shows 1G instead of 1048576)
du -c [path [path] ]
Add Add up space used by file files/directories s/directories under path (or current current dir)
mount -r -t cd9660 /dev/acd0 /cdrom
Mount device device /dev/acd0 [IDE [IDE CD] on directory /cdrom ; filesystem type is cd9660; -r = read- only. only.
umount /cdrom
Unmount device device (must (must not be in use) use)
mount -t msdos /dev/fd0 /mnt
Similar Similar for MS-DOS floppy floppy disk
umount /mnt fstat
List List processes with open files files
cat /etc/fstab
Show files filesystem ystem table
mount /cdrom
Mount /cdrom using using parameters from from /etc/fstab
mount -a
Mount all all file filesys systems tems in /etc/fstab except except those labelled labelled "noaut o" (this (this is done at normal bootup, but is use useful ful when booting booting into into single single-- user mode)
fsck -y /dev/ad0s1d
Repair UFS files filesystem ystem on /dev/ad0s1d . NOTE NOTE:: must be unmo unte d or mounte d read-only read-only
Slices and Partitions fdisk /dev/ad0
Show Show slices slices ("partitions" ("partitions" in DOS terminology) on device device
disklabel /dev/ad0s1
Show Show FreeBS FreeBSD D partitions within within a slice slice
/stand/sysinstall
Has Has options options for for partitioning partitioning and slic slicing ing,, should you need to add another disk disk to an alreadyalready- installed installed FreeBSD FreeBSD system system
iostat 2
Show Show disk disk I/O statistics statistics every 2 seconds
gstat -I 2s
Packages pkg_info
Show Show summary list list of install installed ed packages packages
pkg_info foo-1.2.3
Show Show detailled detailled description description of package package "foo" "foo"
pkg_info foo\* pkg_info -L foo\*
Show list of files files included included in package "foo"
pkg_info -W /usr/local/bin/foo
Find Find which package contains file file /usr/local/bin/foo
pkg_add foo-1.2.3.tbz
Install package from file file
pkg_add -r foo
Install package from default FTP server server
PACKAGEROOT="ftp://ftp.uk.freebsd. org" pkg_add -r foo
Install package from alternative FTP server
pkg_delete foo-1.2.3
Uninstall package
rehash
[csh]
After fter installing a package, rescan PATH PATH for for new executables. (Only needed if you are using csh)
Kernel modules kldstat
Show Show loaded modules
kldload if_wi
Load oad named module module and any modules modules it depends depends on
kldunload if_wi
Unload Unload module
Networking ifconfig -a
Show all interfaces
ifconfig fxp0 192.168.0.1/24
Configu Configure re an interface interface
netstat -r -n
Show Show forwarding forwarding table (routes) (routes)
route add default 192.168.0.254
Add Add static default default route
ping 1.2.3.4
Send test packets, packets, display display responses (^C to exit) exit)
traceroute -n 1.2.3.4
Send Send test test packets packets and displa display y intermediate intermediate routers routers found found
tcpdump -i fxp0 -n -s1500 -X tcpdump -i fxp0 -n tcp port 80
Show Show entire packets packets sent and received received on given given interface; interface; second second form form shows shows only packet packet headers to/from TCP port port 80
telnet 1.2.3.4 80
Open TCP connection connection to port 80 on host 1.2. 1.2.3.4 3.4
vi /etc/rc.conf vi /etc/resolv.conf
Edit Edit startup configuration configuration file file,, DNS resolver resolver configuration configuration file file (see (see "Importa nt Configuration Configuration Files Files") ")
/etc/rc.d/netif start
Initiali Initialise se network interfaces interfaces from settings settings in /etc/rc.conf
/etc/rc.d/routing start
Initiali Initialise se static routes from from settings settings in /etc/rc.conf
/etc/rc.d/dhclient start
Configu Configure re interfaces interfaces marked "DHCP" "DHCP" in /etc/rc.conf
netstat -finet -n
Show Show active network connections [add -a for listening listening sockets]
sockstat -4 -l
Show Show processes listening listening on IPv4 IPv4 sockets
Shutdown reboot
Reboot immediately
halt
Shutdown Shutdown immediately immediately
halt -p
Shutdown immediat ely and turn off off power power if possible possible
shutdown -h 5 "Sys maintenance"
Halt in 5 minutes, send warning message to logged-in logged-in users
Important Configuration Files Many of these are documente d in section section 5 of the the manu al. e.g. e.g. " man 5 crontab" /etc/crontab
Regula Regularr scheduled tasks tasks
/etc/group
Binds Binds suppleme ntary groups to users (won't take effec effectt until they next login) login)
/etc/hosts
Loca Locall mappings between between IP addresse addressess and hostnames
/etc/inetd.conf
Controls Controls servi services ces started started from from inet, inet, but which which don't have have their their own daemon processes. e.g. e.g. ftpd
/etc/localtime
(Binary (Binary fil file, e, not editable) describes the current time zone # cp /usr/share/zoneinfo/Africa/Maputo /etc/localtime
/etc/mail/mailer.conf
Configures Configures which MTA MTA is is used when local local processes generate mail
/etc/make.conf
Defaults Defaults for when when building building software applications/ applications/ por ts
/etc/motd
"Message "Message of the day" displayed displayed on login login
/etc/newsyslog.conf
Configures Configures autom atic rotation of log log files files
/etc/periodic/...
Variou Variouss scripts which are run at scheduled times
/etc/rc.conf
Master configurati on file. file. See /etc/defaults/rc.conf for allowable settings (but don't edit edit them there, there, because because changes changes will will be lost on upgrade) # Network settings hostname="foo.example.com" ifconfig_fxp0="192.168.0 ifconfig_fxp 0="192.168.0.1/24" .1/24" defaultrouter="192.168.0.254"
# or "DHCP"
# Set clock at bootup ntpdate_enable="YES" ntpdate_flags="-b ntp-1.example.net ntp-2.example.net" # Enable services inetd_enable="YES" sshd_enable="YES" /etc/rc.d/...
Startup Startup scripts, scripts, run as /etc/rc.d/foo /etc/rc.d/foo start or /etc/rc.d/foo stop Will Will not work unless the relevant relevant service service_enable="Y _enable="YES ES"" exists exists in /etc/ rc.conf
/etc/rc.local
Create Create this scrip scriptt to perform perform additional additional commands at system system startup startup
/etc/resolv.conf
Configure DNS client client search example.com nameserver 192.0.2.1 nameserver 192.0.2.2
/etc/ssh/sshd_config
Configure Configure ssh daemo n (e.g. (e.g. permit permit or refuse refuse root logins) logins)
/etc/sysctl.conf
Set run-time kernel kernel variables variables at bootu p, e.g. e.g. net.inet.ip.forwarding= net.inet.ip.forwarding=1 1
/etc/syslog.conf
# if this machine is a router
Configure Configure destinations of log log messages. Afte Afterr changing: # killall -1 syslogd
/etc/ttys
Configure Configure logins logins on serial serial lines lines or mode ms
/etc/X11/xorg.conf
X Window server (display) (display) configuratio n. To create: # Xorg -configure # mv /root/xorg.conf.new /root/xorg.conf.new /etc/X11/xorg.conf
/usr/local/etc/...
Configuration Configuration files files for for thirdthird- party programs (ports/packages)
/usr/share/skel/...
Skele Skeleton ton file filess which populate a new user's home directory directory
~/.ssh/authorized_keys
Public Public keys corresponding to the private private keys which which are permit ted to login login to this account using SSH RSA/DS RSA/DSA A authe ntic atio n
Other important files and directories /boot/kernel/kernel
The kernel itsel itself, f, and its loadable loadable modules
/boot/kernel/*.so /boot/loader.conf
Kernel Kernel configuration configuration at startup time. See /boot/defaults/loader.conf and an d /usr/src/sys/i386/conf/GENERIC.hints hint.acpi.0.d isabled=1 if_wi_load="Y ES" snd_driver_load="YES" snd_driver_load="YES"
/dev/null
# disable ACPI # load the 'wi' network driver # load all sound drivers
The The "bit bucket". bucket". To disc discard ard all all output from from a command (stdout (stdout and stderr) stderr):: # somecommand >/dev/null 2>&1
[sh]
/rescue/...
Statical Statically-li ly-linked nked binaries for for use in emergencies
/root
Home directory directory for 'root' 'root' user (so it's still still avai available lable when other files filesystems ystems are not not mounted)
/stand/sysinstall
Run Run this this to re-enter re-enter the installa installation tion menu
/usr/src/sys/i386/ conf/MYKERNEL conf/MYKERNEL
Configuratio Configuratio n file file to build kernel "MYK "MYKE ERNEL RNEL"" (see "GENE "GENERIC RIC"" for the default kernel kernel which comes with with FreeBSD FreeBSD))
/var/db/pkg/...
Where Where pkg_add records installed installed packages (don't alter alter them!)
/var/log/maillog
Mail log file
/var/log/messages
General system log fil filee
/var/mail/username /var/mail/username
Default Default location for user's user's mailbox
/var/run/inetd /var/run/inetd.pid .pid
File File containing containing process process ID of of running 'inetd' 'inetd' daemon
/var/spool/mqueue/...
Sendmail Sendmail queued messages messages
/var/tmp
Temporary files files;; applications applications should write large large files files here rather than /tmp as it's usually on a larger filesys filesystem tem
File permissions ls -l filename ls -ld directory
Show Show permissions on file file or directory. directory. ,------/ ,-----/ / ,---/ / / ,--rwxrwxrwx
type (-=file, rwx perms for rwx perms for rwx perms for
d=directory) user (owner) group other
For a file: file: r allows allows read; w allows allows write/app write/app end ; x allows allows execute. For a directory: r allows allows listing listing cont ent s; w allows allows creation or deletion of files files within directory; x allow allowss directory to be entered chown user path
Change the owner, group, or both, of a fil filee or directory.
chgrp group path chown user user: :group path chmod [ugoa]+[rwx] path chmod [ugoa]-[rwx] path chmod nnn path
Add Add or remove remove permission permission mode bits. bits. u = user (owner), g = group, o = other, a = all (ugo) e.g. e.g. "chmod go+r go+r file " adds adds the 'r' permission permission to group group and other. Change Change all all the mode bits bits at once to octal octal value value nnn. e.g. e.g. "chmod 640 640 file " sets rw- for user, user, r-- for for group, --- for other. 0 --4 r--
umask umask nnn
1 --x 5 r-x
2 -w6 rw-
3 -wx 7 rwx
Show Show or set the file file creation creation mask for this session; session; these are the permission bits which will will not be set on newly-created newly-created file files. s. For example, example, "umask 022" means that newly-created files files have no mor e than rwxr-xr-x rwxr-xr-x permissions. permissions.