Linux

[Linux] Basic web commands

mjk- 2024. 4. 25. 17:24

Useful tip) always use "man" to find the options:

man <command>

 

Web Server

To connect to the internet from your computer, your browser needs to communicate to a web server over protocols like HTTP. 

 

How do we create web servers? - there are several methods:

python3 -m http.server [port] # python 3 server

# http web server with npm
npm install http-server
http-server -p [port]

# http web server with php
php -S [addr]

 

Web Services 

 * we will talk about this topic in detail soon with different post.

 

CURL

  • curl stands for "client for urls"
  • it's a tool to control/test websites and transfer files over protocols like HTTP, HTTPS... 
    • apt is a newer version of "apt-get"
    • apt shows prettier/cleaner results
    • apt-get has more options
  • unlike dpkg, apt downloads the dependencies needed to install a program - efficient!
  • apt-cache <opt> <package>: shows version/information of package
    • apt-cache search <package>
    • apt-cache show <package>
  • sudo apt install <package> -y : install package anyways as a root use

DPKG

  • stands for "debian package manager"
  • low-level packaging tool
  • install deb.files, not their dependencies
  • dpkg -i <-.deb>

Other CMDs

  • wget : download from respositories
  • pip: for python packages
  • git: for git files

 

Backup and Restore

Which command does pop into your head when you should copy your file to other directory or a remote location?

Let's talk about three commands: cp, scp, rsync

  • cp: copy files and directories
  • scp: secure copy; copies files between hosts on a  network using ssh
    • secure than others (unless we use rsync --rsh=ssh)
      • -p: preserve modification
      • -r: recursively copy
  • rsync: a fast, versatile, remote file-copying tool; used to backup 
    • faster & more optimized with delta-transfer algorithm (copy only missing parts)
    • enable interrupt handling 
      • -a: (archeive) preserve original file attributes
      • -v: (verbose) show progress
      • -z: (compress) enable compression

 

 

'Linux' 카테고리의 다른 글

[Linux] apt v. apt-get v. dpkg  (0) 2024.04.17