linuxcommandsiuse
linuxcommandsiuse
Linux Commands I Use
16 posts
Commands I use repeatedly...
Don't wanna be here? Send us removal request.
linuxcommandsiuse · 3 months ago
Text
Create python3 virtual env
python3 -m venv env
0 notes
linuxcommandsiuse · 3 years ago
Text
Check free disk space
df -h
0 notes
linuxcommandsiuse · 3 years ago
Text
Git favourites
Following are my git favourites:
Show a tree graph view won the terminal.
git log --graph --decorate
Git files that changed in a commit.
git show --stat --oneline <hash>
Show commit logs.
git log --oneline
Show difference between commits with changes.
git diff-tree -cc
Show git log with changes.
git log --cc
List of authors who committed to a repo
git shortlog -s -n --all --no-merges
0 notes
linuxcommandsiuse · 4 years ago
Text
How to find the unix os information
cat /etc/os-release
0 notes
linuxcommandsiuse · 8 years ago
Text
Check linux flavour
Usecase: Check the linux flavour
Command:
cat /proc/version
Also proc has a great set of other commands. Check what's available by doing
ls /proc/
0 notes
linuxcommandsiuse · 8 years ago
Text
zip directory
Usecase Zip the current directory and create the zip file in the parent folder
Command
zip -r ./../filename.zip .
Example
zip -r ./../dummy.zip .
0 notes
linuxcommandsiuse · 9 years ago
Text
Find if the process running the command
ps cax | grep nginx
0 notes
linuxcommandsiuse · 9 years ago
Text
Find the process using a port
Following options show the process using port 80
netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
sudo netstat -nlp | grep :80
lsof - list open files
sudo lsof -i :80 | grep LISTEN
0 notes
linuxcommandsiuse · 9 years ago
Text
Start ssh-agent
Do the following in a command window to start the ssh agent service.
eval `ssh-agent -s`
0 notes
linuxcommandsiuse · 9 years ago
Text
scp
Usecase: Copy file from local computer to remote using SSH
Command:
scp [options] username1@source_host:directory1/filename1 username2@destination_host:directory2/filename2
0 notes
linuxcommandsiuse · 9 years ago
Text
apt-get update/upgrade
Usecase: Update linux packages
Commands:
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
0 notes
linuxcommandsiuse · 9 years ago
Text
meminfo
Usecase: When I need to check memory on the machine
Command: egrep --color 'Mem|Cache|Swap' /proc/meminfo
or
free -m
English: Gives a color column output of memory usage.
0 notes
linuxcommandsiuse · 9 years ago
Text
setfacl
Usecase: When you need to define access rights to files and folders for more than one user group.
Command: setfacl -m <rules> <files>
Usage: setfacl -m g:mygroup:rwx /var/somefolder
English: Give user group mygroup read, write and execute access to the folder /var/somefolder
0 notes
linuxcommandsiuse · 9 years ago
Text
netstat
Usecase: Find the program using a given port
Command: netstat -tulpn | grep :<port>
Usage: netstat -tulpn | grep :80
English: Who is using port 80
0 notes
linuxcommandsiuse · 9 years ago
Text
su
Usecase: When I have multiple users and I want to switch from one to antoher:
Command: su <username>
Usage: su jerome. This will prompt you to enter the user password. Once you do that, the terminal session will be as that user
0 notes
linuxcommandsiuse · 9 years ago
Text
nohup
Usecase: When you have a program running in the terminal and exits if you close the terminal.
Command: nohup
Usage: nohup ./someserverapp/bin/start.sh > /var/log/someserver-hohup.out&
English: Run the server start script and redirect the console out to the location I have given
0 notes