linking files and the inode
- identifies files
- permissions
- ownership
- date and time stamps
- paths to data on file system
- everything about the file except for the file name itself
|
|
flag -i shows inode id 1 = one name pointing to that file
|
|
same inode, now there are 2, with same id, and both say there are 2 files pointing to that same id
if you have a program looking for a file, and it doesn’t exist, renaming the file might break something else, so link a new name to the existing file instead
have to create a link on the same file system with hard links
soft links allow you to create links across file systems, and they get new inodes
|
|
lrwxrwxrwx the ‘l’ indicates it is a link
with soft link, removing file that is pointed to breaks the link, and accessing it by file pointed from results in empty file
until you delete a last file that points to an inode, the inode will continue to exist. hard links point to inodes, soft links point to other files
shell expansion
|
|
also see alnum
or punct
brace expansion
echo {Sun,Mon,Tues,Wednes}day.log
Sunday.log Monday.log Tuesday.log Wednesday.log
sequences in brace expansion
touch song{1..5}
song1 song2 song3 song4 song5
use braces to specify the boundaries of a variable, but you don’t have to
variables
|
|
only needed for strings that combine variables with special characters, like underscores
|
|
command substitution
backticks are older, not recommended
$()
is preferred
double quotes are weaker, single quotes are strong (stronger because only need one of them); single quotes will not allow command substitution, double quotes will
prefixing special chars like $ with \ will take away the special meaning of the next character (escaping), this will prevent expansion in a double-quoted string
managing files (again)
cd -
: take me to the previous working directory
getting help (man pages)
MAN(1) : the 1 is the ‘section’
|
|
anything in a man page in square brackets is optional
searching inside man pages is not case sensitive
|
|
section 8: daemons or administrative commands
getting help (info)
hyperlinks, less rigid than man pages
pinfo
eh, arrows don’t work, do i really need this anyway?
redirecting output
channel 0 : stdin channel 1 : stdout channel 2 : stderr channel 3+ : files
what does the &
in 2>&1 mean?
there’s a more modern technique to redirect
write
|
|
append
|
|
useful to hide errors from find when you don’t have permission to see it
|
|
<
to indicate input
tee
command sends to stdout and saves to a file
|
|
vim
modes
- insert (
i
) - command (default)
- extended command (
:
) - visual (
v
)
cw
: change word, deletes word and puts you into insert mode
v
: visual mode
ctrl
+v
: visual block mode
shift
+v
: multiline mode
use vimtutor
for interactive training tutorial
changing the shell environment
|
|
chapter 6: user and group concepts
|
|
first char is x
and represents password, which used to be stored here
/etc/group
: has groups
|
|
user types:
- superuser
- system accounts
- regular users
the super user
gets its power from being UID 0, not from being ‘root’
su
: switch user
as root, you don’t need the password of the user you want to switch to
man page explains the significance of the -
in su -
, which just means start login shell
what is the /etc/shadow
file?
|
|
|
|
managing local user accounts
|
|
managing user passwords
/etc/shadow
where hashed passwords are stored; first $
is the hash type, second $
is the salt value, third $
is the user’s password hash
also shows how long since, how long until change, how soon they can change again, how many days to warn, how many days they can log in after it expires, etc.
Numbers in the 17995 range are how many days since jan 1 1970
|
|
allocate a user a no-login-shell to prevent them from sshing to the system
|
|