A collection of Linux commands and concepts I tend to forget
-
-
Save lvnilesh/4a6fd437648723101a72bd4f84ea04f1 to your computer and use it in GitHub Desktop.
Current directory: pwd
Show file contents: cat File
List file sizes: ls -lah
Log file viewing: tail error_log -n 50
List size of all directories in current directory: find . -maxdepth 1 -type d | xargs du -m -s
find . -name '*{part_of_word}*' -print
cd /
du -ch -d 1 | sort -hr
...or ncdu
Free disc space: df -h
Directory size: du -sh /var
sudo apt-get autoremove
zip -r foo.zip dir_path
unzip .zip-file-name -d /path/to/extract
There are three permissions you can set, and there are three classes that can receive those permissions.
read, write, execute
user, group, others
Symbolic Notation Octal Notation English
---------- 0000 no permissions
---x--x--x 0111 execute
--w--w--w- 0222 write
--wx-wx-wx 0333 write & execute
-r--r--r-- 0444 read
-r-xr-xr-x 0555 read & execute
-rw-rw-rw- 0666 read & write
-rwxrwxrwx 0777 read, write, & execute
#list users
cat /etc/passwd
#list groups
cat /etc/group
Each user usually has at least one corresponding group, which has the same name as the user.
Directories are just special files, and they have the same owner and permission rules as ordinary files.
ps -ef | grep php
top
displays memory usage: Shift
+ f
, then press n
- Understanding Load avarages - good article by Scout App
free
- shows available memory
Explaination: http://www.linuxatemyram.com/
free -m
To see how much ram is free to use for your applications, run
free -m
and look at the row that says "-/+ buffers/cache" in the column that says "free". That is your answer in megabytes:
see also http://www.cyberciti.biz/faq/linux-check-memory-usage/
sudo iftop
sudo nethogs eth0