How to enable telnet on Windows 10 No further Introduction is needed for this tool … Open command line as an administrator and write the following command. Hit enter & your’re done!
1 |
dism /online /Enable-Feature /FeatureName:TelnetClient |
How to enable telnet on Windows 10 No further Introduction is needed for this tool … Open command line as an administrator and write the following command. Hit enter & your’re done!
1 |
dism /online /Enable-Feature /FeatureName:TelnetClient |
To find the largest files and directories on a linux server, type the command bellow… and grab a cup of coffee afterwards. Change head -n $top_num to your liking to get the top x files and/or directories.
1 |
du -a / | sort -n -r | head -n 5 |
Cloud-init doesn’t work with predictable network names … So In favor of cloud-init automated network set up disable them. In: /etc/default/grub Change to: GRUB_CMDLINE_LINUX=”net.ifnames=0 biosdevname=0″ source
Find files or directories owned by user/group and permission bits Find all files not owned by user
1 |
find dirPath ! -user {user-name} |
Find all files not owned by group
1 |
find dirPath ! -group {group-name} |
Find all files that don’t have specific permissions
1 |
find dirPath ! -perm {perm-bits} |
Examples: Find all files that don’t have 755 permissions
1 |
find dirPath ! -perm 755 |
Combine all parameters: Find all python files […]
Find and Delete log files on a linux system. Think before you act.
1 |
find / -name '*bash_history*' -name '*.bash_logout' -name '*log*' -name '*ksh_history*' -name '*bash_logout*' -name '*utmp*' -name '*wtmp*' -name '*adm*' |
Mount disk and install grub boot loader
1 2 |
mount /dev/sdX /mnt grub-install --boot-directory=/mnt/boot /dev/sdX |
Delete all lines of a file containing a regex pattern using sed. For example you can delete all commented lines of a default configuration file. Take a look on my basic regex cheat sheet
1 |
sed -i '/regexPattern/d' path/to/file1.log |
Replace a string with a new one in all files using sed and xargs
1 2 3 |
oldstring="some_string_to_search" newstring="new_string_to_replace" grep -rl $oldstring /path/dir/ | xargs sed -i s@$oldstring@$newstring@g |
Comment specific line using sed command can be used to configuration files …
1 |
sed -i '123 s/^/#/' filename |
Should be used for really huge database imports like tens of GB … Note: remember to navigate to the directory where your .sql file lives so you can use source on it later …
1 2 |
cd path/to/dir/ mysql -u root -p |
Note: if you’re not sure what these options do, please, do some research first.
1 2 3 4 5 6 7 8 9 |
set global net_buffer_length=1000000; --Set network buffer length to a large byte number set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number SET foreign_key_checks = 0; --Disable foreign key checking to avoid delays,errors and unwanted behaviour source file.sql --Import your sql dump file SET foreign_key_checks = 1; --Remember to enable foreign key checks when procedure is complete! |