Wednesday, January 28, 2015

Common Linux Commands

1. Remove broken applications.
apt-get -f install
apt-get autoremove

2. Install binary package with Package manager (Ubuntu)
install .deb file in Ubuntu
dpkg -i teamviewer_amd64.deb

Without dependency
dpkg --force-depends -i teamviewer_amd64.deb

3. Print Architecture
dpkg --print-architecture

4. Download file from console
wget http://software.dakotawallender.com/Teamviewer/teamviewer_10.0.36281_amd64.deb

5. Search a file
locate teamviewer_10.0.36281_amd64.deb


6. Show disc partition
fdisk -l

7. Show who/when is logged on and what they are doing
w

8. List files
ll
ll -h (human readable)
ls -l

9. Install a program
sudo apt-get install mysql

10. Find Application Depends
cd <to the directory where your .deb file is placed)
dpkg-deb -I teamviewer_10.0.36281_amd64.deb | grep Depends

11. Shutdown
poweroff

12. Create file
touch myfile.txt

13. Service start stop and status
service apache2 start
service apache2 stop
service apache2 restart
service apache2 status

note: apache2 is a service you can use any one like mysql

14. Display Linux processes
top

15. Show running services
service --status-all

16. Show last part of a file
tail myfile.txt

17. Tell how long the system has been running
uptime -p

18. kill - send a signal to a process
kill PID (process ID)

19. report a snapshot of the current processes
ps

20. Compress file using TAR
tar -cvf /home/brij/mydir.tar mydir

21. Change permission
chmod -R 777 /home/brij/mydir.tar

22. Restart system
reboot

23. OpenSSH SSH client (remote login program)

login using password
ssh user@10.10.55.56

login using .pem (key) file
ssh -i/home/brij/Downloads/my_key.pem user@10.10.55.56

24. Un-compress file using TAR
tar -xzf /home/brij/brij.tar.gz

25. secure copy (remote file copy program)
scp source destination

26. Show file content and concatenate
cat myfile.txt

27. Display amount of free and used memory in the system
free -h



Feel free to comment, if you like this post :)

No comments:

Post a Comment