Debian GNU/Linux help
Useful commands
- Important for installations in the console
For selection fields press the space bar to mark fields. - Search in files
git grep "[SEARCH]"
- Unzip files
tar -xzvf *.gz
tar -jxvf *.bz2 - Show current Linux version
lsb_release -a
- Update short form
apt update && apt upgrade -y && apt full-upgrade -y && apt autoremove -y
The individual commandsapt update
apt upgrade
apt full-upgrade
===apt-get dist-upgrade
apt autoremove
- Service systems
Which system does my operating system use? SysVInit or SystemD?ps -p 1
SystemD, Newsystemctl status [SERVICE]
SystemD, the path to the command is specified explicitly/bin/systemctl status [SERVICE]
SysVInit, Deprecated/etc/init.d/[SERVICE] status
SysVInit,service
often associated with/etc/init.d/
service [SERVICE] status
- Service commands
systemctl status [SERVICE]
systemctl start [SERVICE]
systemctl stop [SERVICE]
systemctl restart [SERVICE]
systemctl enable [SERVICE]
(add to autostart)systemctl disable [SERVICE]
VirtualBox guest extension
- Switch to root user
su -
- Update software
apt update && apt upgrade -y && apt full-upgrade -y && apt autoremove -y
Restart when a new Linux kernel has been installed. - Install packages for building kernel modules
apt install build-essential module-assistant dkms
- Preparation for creating kernel modules
m-a prepare
- Insert guest extension
Devices -> insert guest additions ...
Run (CD is mounted) - Install guest extension
sh /media/cdrom0/VBoxLinuxAdditions.run
- Check modules
lsmod
orgrep -io vboxguest
orxargs modinfo
orgrep -iw version
- Only members of the vboxsf group have access to automatically integrated folders
vboxsf = VirtualBox shared foldersudo adduser [USER] vboxsf
- Restart -> Done
Users
- Show all users
cat /etc/passwd | cut -d: -f1
- Switch to root user
su -
- Create new user
adduser [USER]
- Change user
su [USER]
- Add user to group
adduser [USER] [GROUP]
- Remove user from group
deluser [USER] [GROUP]
- Show groups of the user
groups [USER]
- List all groups
groups
- Delete user
deluser [USER] --remove-home --remove-all-files
- Delete group
delgroup [GROUP]
visudo
([GROUP] ALL=(ALL:ALL) ALL
-> Delete lines if any) - Login as www-data
su -s /bin/bash www-data
(no password is set;www-data
,to-www
orauto-www
)
Owners and Rights
chown -R [USER]:[GROUP] [FOLDER/FILE]
chmod -R 775 [FOLDER/FILE]
chmod g+s
Symbolic (umask u=rwx,g=rx,o=
)
u = User
g = Group
o = Other
Permissions
r = read
w = write
x = execute
Octal (umask 022
)
0 = read, write and execute
1 = read and write
2 = read and execute
3 = read only
4 = write and execute
5 = write only
6 = execute only
7 = no permissions
Cron Jobs
- View root cron jobs
crontab -l
- Cron jobs are saved here
/etc/cron.*
- Software specific cron jobs
/etc/cron.d
- Add cron job
crontab -u [USERNAME] -e
crontab -u dreadyhead -e
Select editor and insert job entry at the bottom. - Control cron jobs
crontab -u [USERNAME] -l
- Change cron job
crontab -u [USERNAME] -e
- Delete cron job
crontab -u [USERNAME] -r
TrueCrypt
- Download package
wget http://www.truecrypt.org/download/truecrypt-7.1a-linux-x86.tar.gz
wget http://www.truecrypt.org/download/truecrypt-7.1a-linux-x64.tar.gz
- Unzip
tar -xzvf truecrypt-7.1a-linux-x86.tar.gz
- Install
sudo ./truecrypt-7.1a-setup-x86
- Uninstall
sudo truecrypt-uninstall.sh
- Execute
truecrypt
Filezilla
apt install filezilla
LFTP
apt install lftp
Run *.sh file
chmod +x [FILENAME]
./[FILENAME]
Convert line endings
DOS/Windows line break (CR LF
), in Unix System (LF
) convert end of line / line break.
apt install dos2unix
- Now you can convert the line endings in both directions
dos2unix [FILE]
unix2dos [FILE]
- Testing
vi [FILE]
:x!
to leave vi
JDK for NetBeans is already installed
- Testing
java -version
- Folder
/usr/lib/jvm/java-8-openjdk-amd64
Compare two folders
diff -rq [FOLDER1] [FOLDER2]
-r
= Recursively compare any subdirectories found.-q
= Output only whether files differ.
Symbolic Link
ln -s [FOLDER/FILE] [SYMLINKNAME]
Uninstall a package
dpkg --list
- Check dependencies
apt-cache depends [PACKAGE]
- Remove package
apt remove [PACKAGE]
- Remove package and its configuration files
apt purge [PACKAGE]