What is
Linux?
Linux is mainly used in Servers. Linux is an Operating System’s Kernel.
You might have heard of UNIX. Well, Linux is a UNIX clone. But it was actually
created by Linus Torvalds from Scratch.
The
following contents will be presented:
- Use the basic Linux commands touch, cp, cd, ls, mv, mkdir, rm and pwd
- Basic file read/write using echo, cat and the Vi text editor
- Search for a file or file contents using file and grep
- Compress and decompress folders using tar
- Get the system date and time using the timedatectl, date and hwclock commands
- Create, run in the background and kill a shell script, using the chmod, ps and kill commands
- Monitor system performance using the system manager htop
- Run a script automatically at boot time, by creating a service
- Change the system password using passwd
- Download files, using wget
- Use the opkg package manager to list, install and remove packages
Commands
1. ls
The ls command displays the names of the files and directories in the current
working directory. A number of options are available that allow you to specify
what details about the files should be shown.
2. cd
If you want to change the current working directory you would use
the command cd. For example cd correspondence would set the
current working directory to correspondence,
if it exits.
3.
pwd
When you first open the terminal, you are in the home
directory of your user. To know which directory you are in, you can use the “pwd”
command. It gives us the Absolute Path, which means the path that starts from
the root. The root is the base of the Linux filesystem. It is denoted by a
forward slash( / ). The user directory is usually something like
/home/username.
4. mkdir & rmdir
The mkdir command is used when you
need to create a folder or a directory. For Example, if you want to make a
directory called “DIY”, then you can type “mkdir DIY”. Remember, as told
before, if you want to create a directory named “DIY Hacking”, then you can
type “mkdir DIY\ Hacking”.
rmdir is the command used for deleting a directory.
But, rmdir can only be used to delete an empty directory. To
delete a directory containing files, rm is used.
5. rm
The rm command is used to delete
files and directories. rm cannot simply delete a directory. “rm
-r” is used to delete a directory. In this case, it deletes both the folder
and the files in it.
yppasswd -- to change passwd
ls -- to list files and directories
cd -- to change directory
pico -- To create or edit a file
vim -- Advance text editor
chmod -- change file access permissions
pwd -- shows the "present working directory"
cp -- copy the files/diectories
mv -- move or rename the file/directory
rm -- remove files/directory
mkdir -- make a new directory
rmdir -- deletes a (empty) directory
date -- show date and time
cal -- show calendar
du --show file space usage
logout -- make you exit
man -- show the manual pages
tin -- to check newsgroups
telnet -- to login into other computer/server
ssh -- secure login into other computer/server
finger -- look for information about users logged on server
talk -- to other user
w -- Show who is logged on and what they are doing
write -- to other users
ftp -- to transfer files from one computer to another
cat -- print the file(s) on standard output
alias -- alias a command
locate -- locate a file containing some expression
grep -- print lines matching a pattern
df -- show harddisk partitions
tar -- compress/uncompress files/directories
tar -xvf file.tar -- uncompress a file 'file.tar'
tar -xzvf file.tar.gz -- uncompress a file 'file.tar.gz'
tar -xjvf file.tar.bz2 -- uncompress a file 'file.tar.bz2'
tar -cvf file.tar file -- compress the file 'file' to 'file.tar'
tar -czvf file.tar.gz file -- compress the file 'file' to file.tar.gz
tar -cjvf file.tar.bz2 file -- compress the file 'file' to file.tar.bz2
No comments:
Post a Comment