Top Ubuntu 14.04 lts command

==================
ls command options
==================

option description
ls -a list all files including hidden file starting with '.'
ls --color colored list [=always/never/auto]
ls -d list directories - with ' */'
ls -F add one char of */=>@| to enteries
ls -i list file's inode index number
ls -l list with long format - show permissions
ls -la list long format including hidden files
ls -lh list long format with readable file size
ls -ls list with long format with file size
ls -r list in reverse order
ls -R list recursively directory tree
ls -s list file size
ls -S sort by file size
ls -t sort by time & date
ls -X sort by extension name

===================
ls command examples
===================
You can press the tab button to auto complete the file or folder names.
-----------------------------------------------------------------------

List directory Documents/Books with relative path:
$ ls Documents/Books

List directory /home/user/Documents/Books with absolute path.
$ ls /home/user/Documents/Books

List root directory:
$ ls /

List parent directory:
$ ls ..

List user's home directory (e.g: /home/user):
$ ls ~

List with long format:
$ ls -l

Show hidden files:
$ ls -a

List with long format and show hidden files:
$ ls -la

Sort by date/time:
$ ls -t

Sort by file size:
$ ls -S

List all subdirectories:
$ ls *

Recursive directory tree list:
$ ls -R

List only text files with wildcard:
$ ls *.txt

ls redirection to output file:
$ ls > out.txt

List directories only:
$ ls -d */

List files and directories with full path:
$ ls -d $PWD/*
==============================================
Monitiring tools
==============================================
1. Htop Task manager
sudo apt-get install htop
htop

2. IPTRAF
sudo apt-get install iptraf
sudo iptraf

3. /PROC
To get information about system devices with the help of the /Proc file system, you can use these various commands:
cat /proc/cpuinfo
cat /proc/mounts
cat /proc/meminfo
cat /proc/zoneinfo

===============================================
Mix Commands
===============================================
1. Brag about how much free RAM you have on Linux:
free
2. Where is that application I just installed (all directories)
whereis [app]
3. Disk space usage
df -h
4. To make a playlist of the audio files in a folder
ls -R > playlist.m3u
5. To kill a process by it’s name:
sudo killall <prog_name>
for instance: sudo killall firefox. Or you can kill by pid (program id):
sudo kill <pid>
and to see the pid:
pidof <program name>
for instance: pidof firefox
or you can try listing the currently running processes with:
ps -e
6. To find out the version of installed software:
apt-cache policy <packet_name>
7. To find out the UUID of your partitions:
ls /dev/disk/by-uuid/ -alh
8. Display the top ten running processes - sorted by memory usage:
ps aux | sort -nrk 4 | head
9. Set audible alarm when an IP address comes online
ping -i 60 -a IP_address
10. Mount a .iso file in UNIX/Linux:
mount /path/to/file.iso /mnt/cdrom -oloop
11. Sharing a file through http 80 port:
nc -w 5 -v -l -p 80 < file.ext
From the other machine open a web navigator and go to ip from the machine who launch netcat, http://ip-address/
If you have some web server listening at 80 port then you would need stop them or select another port before launch net cat ;-)
P.s.: You need netcat tool installed

12. Allows system wide changes:
su
13. Converts a single FLAC (or APE) file with associated cue file into multiple FLAC files:
cuebreakpoints "$2" | shnsplit -o flac "$1"
Requires:
- cuetools
- shntools

14. Add the ID3 tags in a cue file to the flac files:
cuetag *.cue *.flac ;
Requires:
- cuetools

15. Extract audio stream from an AVI file using mencoder:
mencoder "${file}" -of rawaudio -oac mp3lame -ovc copy -o audio/"${file/%avi/mp3}"
16. Capture video of a linux desktop:
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
17. Download an entire website:
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
-p parameter tells wget to include all files, including images.
-e robots=off you don't want wget to obey by the robots.txt file
-U mozilla as your browsers identity.
--random-wait to let wget chose a random number of seconds to wait, avoid get into black list.
Other Useful wget Parameters:
--limit-rate=20k limits the rate at which it downloads files.
-b continues wget after logging out.
-o $HOME/wget_log.txt logs the output

18. Kill: a process that is locking a file:
fuser -k filename

19. Don't miss the next PI or 234567890 day, find out current unix time:
date +%s

20. Scans for open ports using telnet:

HOST=127.0.0.1;for((port=1;port<=65535;++port)); do echo -en "$port ";if echo -en "open $HOST $port\nlogout\quit" | telnet 2>/dev/null | grep 'Connected to' >

/dev/null; then echo -en "\n\nport $port/tcp is open\n\n";fi;done | grep open

21. list of ftp session
ps axuw | grep vsftp

22. check connection session on port,and without port.
lsof -i :21              all session
ss -nlp | grep 80
sudo socklist
netstat -atun
netstat -antp
netstat -tulnp | grep 80
sudo netstat -ntlp | grep :80
netstat -tulpn

23. show information like tasks, memory, cpu and swap. Press ‘q‘ to quit window
top all prosess
top -u root root user process
24.
ls --color / /bin



Extar link
monitoring tool
http://www.upubuntu.com/2012/06/list-of-best-system-monitoring.html
https://blog.serverdensity.com/80-linux-monitoring-tools-know/
SHARE

Ibrar Ansari

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment