torstai 28. maaliskuuta 2013

Useful Linux commands

Useful commands:

Create folder: mkdir name
Delete folder: rmdir name
create multiple folders named a,b,c,d...z: mkdir {a..z}
create file: cat > test.txt
deleting file: rm -f -r {file-name}

Where,
-f: Forcefully remove file
-r: Remove the contents of directories recursively 


Remove / Delete directory called /tmp/foo

Open the terminal. Type the following command:
$ rmdir /tmp/foo

Recursive removal

Remove all files and directories (recursive removal):
$ rm -rf /path/to/directory
$ rm -rf /tmp/foo

 
create multiple files named a1,a2,a3..a10: touch a{1..10}.txt
add user: adduser testuser
delete user: userdel testuser
change user password: passwd username
list files: ls
list also hidden files: ls -a
mount foulder home: cd /home
cd to user folder: cd username
recursively delete folders: rm -r directoryname
add group: groupadd groupname
delete group: groupdel groupname
print working directory: pwd
exit on line terminal: ctrl + C
show useful information about computer: facter

Install ssh-server (every user has shell acces by default):
sudo apt-get install openssh-server

remove installed app:
sudo apt-get remove apache2*
apt-get purge apache2  /will remove all config files

acces ssh: ssh username@localhost

Good place to know:
/etc/hosts 

Remove all things related to specific app:
sudo apt-get --purge remove apache2
Find all related config files for specific program:
dpkg --listfiles munin-node

Ei kommentteja:

Lähetä kommentti