DEV Community 👩‍💻👨‍💻

Fayaz Ahmed
Fayaz Ahmed

Posted on

Some Useful Linux Commands I use at work.

Whats my ip address?

curl ifconfig.me
Enter fullscreen mode Exit fullscreen mode

Connect to remote server with ssh (via pem file)

ssh -i ./file.pem username@ip_address
Enter fullscreen mode Exit fullscreen mode

Copy File local to remote server (via pem file)

scp -i ./file.pem file.zip username@ip_address:/home/directory/file.zip
Enter fullscreen mode Exit fullscreen mode

Unzip a file

unzip file.zip -d /location
Enter fullscreen mode Exit fullscreen mode

Kill a unresponsive PORT

sudo lsof -t -i:PORT_NUMBER
Enter fullscreen mode Exit fullscreen mode
kill PID
Enter fullscreen mode Exit fullscreen mode

Kill a unresponsive app

xkill
Enter fullscreen mode Exit fullscreen mode

Create a new file

touch FILE_NAME.EXTENSION
Enter fullscreen mode Exit fullscreen mode

Search all files inside directory with line Number

grep nr- 'Search Term' .
Enter fullscreen mode Exit fullscreen mode

List files

ls - (List files in current directory)
ll - (List files in current directory with file permissions)
Enter fullscreen mode Exit fullscreen mode

Folder size

du -sh *
Enter fullscreen mode Exit fullscreen mode

Unzip a .tar file

tar -xvf FILE_NAME.tar
Enter fullscreen mode Exit fullscreen mode

Connect to SSH with username and ip address (Digital Ocean)

ssh username@ip_address
Enter fullscreen mode Exit fullscreen mode

Display File content

cat FILE_NAME.js
Enter fullscreen mode Exit fullscreen mode

Download a website

wget https://google.com
Enter fullscreen mode Exit fullscreen mode

UBUNTU - Open current directory in File explorer (UI)

nautilus .
Enter fullscreen mode Exit fullscreen mode

Top comments (3)

Collapse
 
terkwood profile image
Felix Terkhorn

Great set of tips, there were a couple new ones in here for me! Thanks! I'll now avoid asking Google for my IP 😉

Collapse
 
fayaz profile image
Fayaz Ahmed Author

Used to do the same earlier.

Collapse
 
dimitri_acosta profile image
Dimitri Acosta

I believe that ll is not actually a command, it is an alias of ls -alF (at least in Ubuntu) and it is not by default in all Linux distributions, though it is very useful when it is present.

What image format should you use in your next project? 🤔