This article explains some very basic linux commands an facts needed when setting up and working with a web server. Note that this article isn’t covering all about Debian, in fact covers a very few but important knowledge one may need.
This article contains information mainly for beginners.
Some useful facts
- under Linux, everything is a file. Even a device, such as a HDD or port
- files have no extension. In fact the can have but files aren’t recognized by extension. Thus, in a file named ‘aaa’ you can put a wav sound, a text, or anything binary. File names are case-sensitive!
- you can add/remove software (packages) with apt-get. There are no two similarly named packages in Linux. These programs/packages usually hold their config files under /etc
- there are programs or services. Programs are like a text editor. You can run many instances and you can exit them. Services are running in background (eg. ftp, apache).
- the main system is text-based. You must write at the command prompt to interact with the system. BTW everything is very simple and archaic…
To log in or log out
Logging in is automatically initiated. Without logging in you can’t do anything, even you can’t stop the server (except pressing the power button to initiate shutdown)
To log out use:
logout
To start/stop/reboot the machine
Use one of the following:
reboot halt shutdown -h now
To see what’s here (files and directories here)
ls ls -l ls --help
To change directory
cd lower_dir cd /absolute_dir/dir/dir
You may want to see more files/directories so install the Linux’s Norton Commander-like app, Midnight Commander:
apt-get install mc mc
See the free space
df df -h
Change the permissions over files and dirs
chmod 0xxx filedir chmod --help
You can read more about permissions at wiki.debian.org.
To manage running services
If you change a service’s config, you must restart the service.
/etc/init.d/xxxxx restart /etc/init.d/xxxxx stop /etc/init.d/xxxxx start service xxxxx restart service xxxxx stop service xxxxx start
Replace xxxxx with the service name.
[To be continued…]