-
Notifications
You must be signed in to change notification settings - Fork 0
Linux
Andrei Montchik edited this page Apr 29, 2024
·
22 revisions
- Host information, kernel and OS version etc:
hostnamectl - Shell type:
echo %0 - Review environment variables:
printenvenv
- Reboot:
sudo reboot - Latest restart time:
uptime - All processes info:
ps -eforps aux - Specific process info:
ps -p <pid> -o pid,vsz=MEMORY -o user,group=GROUP -o comm,args=ARGS - Show the kernel message buffer since the latest reboot:
dmesg -T
- Configuration location:
/etc/systemd/system/ - List of units:
sudo systemctl list-units --all- Mark inactive units:
sudo systemctl list-units --all --state=inactive
- Mark inactive units:
- Show only directories:
ls -la | grep "^d" - Find file by name:
- from current directory:
find . -name "docker-compose*" - from the root:
find / -name "docker-compose*"
- from current directory:
- Find the program location:
which python3ortype -a python3orcommand -v python3 - Recursive search in current directory:
grep -r "engine-migrations" . - Show just the file name containing the search string:
grep -i -l setmarket *
- Groups configuration location:
/etc/group - List of groups:
groups - Users in a group:
grep docker /etc/group - Add user to a group:
sudo usermod -a -G docker andrei - Add user to the sudoers file, use the
sudo visudoeditor. - Change owner recursively:
sudo chown -R newuser:newgroup /mnt/data
- Install openssh-server to allow SSH access, if it is not yet installed:
sudo apt-get updatesudo apt-get install openssh-server- Start the server
sudo service ssh startorsudo systemctl start ssh
- Create the new user, add it to the sudoers group and re-login.
- Configure SSH Keys for Authentication.
- Disable password authentication.
- Restrict user access to specific users or groups.
- Disable the root access. Make sure to add your user to the sudo group first!
- Archive files:
tar -cvzf archive.tar.gz file1 file2 - Archive directory:
tar -czvf archive-name.tar.gz /path/to/directory - View the archive contents:
tar -tvf archive.tar.gz - Test the archive:
- zst:
zstd --test archive.tar.zst
- zst:
- Extract:
- bz2 archive:
tar -xjf archive.tar.bz2 - gz archive:
tar -xvf archive.tar.gz - zst archive:
tar -I zstd -xvf archive.tar.zst
- bz2 archive:
- Install application from the
.debarchive:sudo dpkg -i your-package-name.deb
- Create symbolic link to file:
ln -s ../../../../../cpp/common/messaging/sbe/me/me.xml . - Create symboli link to directory:
ln -s /path/to/src_directory ~/symlink_directory
- Copy file from host:
scp andrei@64.233.160.01:/home/andrei/data/account_update.json . - Copy directory from host:
scp -r sol@64.233.160.01:/home/andrei/data/ . - Copy file to network host:
scp account_update.json andrei@64.233.160.01:/home/andrei/data - Copy directory to network host:
scp -r data andrei@76.16.6.193:/tmp
- Generate UNIX Timestamp:
date +%s - Rotate logs:
logrotate /etc/logrotate.hourly.d/containers