Hello there! If you are new here, you might want to subscribe to the RSS feed to receive updates.
I’m going to assume that you know how to do some basic stuff in Linux. In other words, if you don’t know what a command line is, or how to traverse directories, this might not help you much.
I should also note that my preferred flavor of Linux is Ubuntu. These commands will work on Ubuntu, but I can’t make any guarantees for other distributions. Best to just try them out and see what happens!
Without further ado, here are some more of the top linux tips and tricks that I have gathered over the years…
Show current Ubuntu version:
lsb_release -a
Count number of files in the current directory:
ls -1 | wc -l
Find files edited in last 1 day in the current directory:
find ./ -ctime -1 -print
Empty a file’s contents of all but the last 5 lines:
tail -5 file.nam > file.nam
Truncate a file to zero length:
:>filename
Show version/dependency info for a given [package name]:
dpkg -s [package name]/mysql
See what installed packages still have stuff pointing to a location such as /etc/mysql:
dpkg -S etc/mysql
Set time, data, and timezone:
Set the time zone:dpkg-reconfigure tzdata
date MMDDHHMMYYYY.SS
hwclock --utc --systohc
fdisk -l
hdparm -i /dev/sda
(substitute
Show partition info (UUID, TYPE, etc.):/dev/XXX
for /dev/sda
)blkid
That’s it for this round. Have fun!
0 comments:
Post a Comment