UNIX-like file systems:
/
/home/mebioda
../../tmp
Directory | Description |
---|---|
/bin |
Single user binaries |
/dev |
Hardware devices |
/etc |
Configuration files |
/home |
User home dirs |
/lib |
Libraries |
/sbin |
System binaries |
/tmp |
Temporary files |
/usr |
Multi user utilities |
/var |
Variable files |
Command | Function | Command | Function |
---|---|---|---|
ls |
List files | mv |
Rename/move files |
cd |
Change directory | mkdir |
Make directory |
pwd |
Print working directory | rmdir |
Remove directory |
rm |
Remove files | chmod |
Change file mode |
cp |
Copy files | chown |
Change file owner |
# file listing
$ ls
# long (-l) listing of all (-a) files, sizes in (-h) human readable format:
$ ls -lah
# manual pages of ls
$ man ls
chmod
permission bits:
bits | code | value | 2n |
---|---|---|---|
001 | x | 1 | 20 |
010 | w | 2 | 21 |
100 | r | 4 | 22 |
Hence:
# set text file rw for user, r for others:
$ chmod 644 file.txt
# set script rwx for user, rx for others:
$ chmod 755 script.sh
Command | Function |
---|---|
more |
Page through text |
head |
View first lines |
tail |
View last lines |
grep |
Search for pattern |
sed |
Search and replace |
sort |
Sort lines |
uniq |
Filter duplicate lines |
cut |
Cut columns from table |
paste |
Concatenate columns |
join |
Join matching columns |
cat |
Print file contents |
wc |
Word count |
awk |
Tabular data processing |
The output from one program can be piped into the input from the next:
cat file | sort | uniq > sorted_no_dups
Source code can be compiled into binary following standard (optional) steps:
tar -xzf prog.tar.gz
cd prog
(autoconf)
(./configure)
make
sudo make install