NB: All new filesystem-related stuff should go here. However I am not moving some older gists from this page to avoid breaking links.
In July 2024 I used this answer to successfully retrieve passwords stored by DBeaver version 21.0.5.202105160657 release date May 17, 2021 in my Ubuntu 20.04 system. In particular, I used the incantation shown then with the proposed change for Linux, i.e.:
openssl aes-128-cbc -d -K babb4a9f774ab853c96c2d653dfe544a -iv 00000000000000000000000000000000 -in ~/.local/share/DBeaverData/workspace6/General/.dbeaver/credentials-config.json | dd bs=1 skip=16 2>/dev/null
Trying to mount a, just purchased, blank CD as in:
$ sudo mount /dev/sr0 /media/cdrom… will give you:
mount: /media/cdrom: can't read superblock on /dev/sr0.Apparently at that point there is no filesystem at all on the disk. So simply insert the blank disk in the CD-ROM device and use the Brasero CD/DVD burner to burn a "data CD". Works like a charm.
$ timedatectl set-ntp no $ timedatectl set-time 1974-12-24 $ timedatectl set-time 03:05:49 $ // do what you want to do ... $ timedatectl set-ntp yesNB: set-time is indeed used for both date and time.
In November 2022 I was initially unable to install kdiff3 on my Ubuntu 20.04 machine due to missing and broken packages. I was able to fix that with the following sequence:
sudo apt update --fix-missing sudo apt install -f sudo apt --fix-broken install sudo apt autoremove
… after which sudo apt install kdiff3 succeeded.
In September 2022 I replaced my Logitech mouse with a "Microsoft Comfort 4500" mouse on my ThinkStation P320 machine (running Ubuntu 20.04). I had to configure both the mouse acceleration and the wheel speed (both were very slow). The scripts I used are found in the following locations:
ls /etc/apt/sources.list.d
The normative way to upgrade is:
sudo apt update sudo apt upgrade… followed by:
sudo do-release-upgrade(read more here)
In February 2022 I encountered problems when following the above procedure as it failed, at the last step, with the following:
Checking for a new Ubuntu release Please install all available updates for your release before upgrading.
It turned out that this was due to a broken Python installation which I had to fix like this.
Sometimes, during apt-get update you get hit by the following:
the following signatures couldn’t be verified because the public key is not available
E.g. like the following output:
$ sudo apt-get update Ign http://security.ubuntu.com trusty-security InRelease Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B] ... Fetched 21.9 MB in 14s (1,537 kB/s) Reading package lists... Done W: GPG error: http://security.ubuntu.com trusty-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32 W: GPG error: http://archive.canonical.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
In such cases, the following fixes it:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
env XDG_CURRENT_DESKTOP=GNOME gnome-control-centerprovenance: https://askubuntu.com/q/542744/89663
NB: this is the preferred way as it affords greater control and does not require sudo
After downloading the Artifactory Pro zip file from this page I followed the instructions on this page under the Manual Installation heading:
To install Artifactory manually, simply unzip the Artifactory download file to a location on your file system. This will be your $ARTIFACTORY_HOME location.
No further action is needed.
Don't forget to modify your JVM parameters as needed by setting JAVA_OPTIONS in $ARTIFACTORY_HOME/bin/artifactory.default.
I did not bother to set an ARTIFACTORY_HOME environment variable in my environment, nor did I bother to edit the JAVA_OPTIONS in the $ARTIFACTORY_HOME/bin/artifactory.default file.
The only thing I did edit was the $ARTIFACTORY_HOME/tomcat/conf/server.xml file where I simply changed the value of a single connector port from 8081 (that's the first one that appears inside the Catalina service element) to 9081
To launch artifactory I simply followed the instructions on the above page under heading Running Artifactory:
… I just used artifactory.sh from a console terminal — I didn't bother with running it as a daemon.Running Artifactory
You can run Artifactory manually to see its behavior by directly executing: $ARTIFACTORY_HOME/bin/artifactory.sh The console is locked on the Artifactory process and you can stop it cleanly with Ctrl+C. To directly run Artifactory as a daemon process, using the environment variables of the shell you are currently in, execute the following script: $ARTIFACTORY_HOME/bin/artifactoryctl start
After confirming with lsb_release -a
that my release is codenamed xenial,
I followed the instructions on
this page:
$ echo "deb https://jfrog.bintray.com/artifactory-pro-debs xenial main" | sudo tee -a /etc/apt/sources.list $ curl https://bintray.com/user/downloadSubjectPublicKey?username=jfrog | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install jfrog-artifactory-pro
To check the service, and in contrast to what one is advised in the linked page, the following did not work:
sudo service artifactory check… instead, I confirmed correct installation with:
sudo systemctl status artifactory.service sudo tail -f /var/opt/jfrog/artifactory/logs/artifactory.log… while also trying the following (for additional assurance):
$ sudo systemctl stop artifactory.service $ sudo systemctl start artifactory.service
When, following the above steps, I tried to connect to:
http://localhost:8081/artifactory
… but my Nexus Repository Manager was already running there, so I edited
the following file:
/var/opt/jfrog/artifactory/tomcat/conf/server.xml
Simply fetch the version you need from https://nodejs.org/en/download/:
wget https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz tar xf node-v8.11.4-linux-x64.tar.xzSee this note on how to build from sources.
When I was trying to execute
sudo apt-get install python3… I would eventually see the following problems:
dpkg: error processing package python3 (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration dpkg: dependency problems prevent configuration of idle3: idle3 depends on python3 (>= 3.5.1-3); however: Package python3 is not configured yet.
Trying the following:
sudo dpkg --remove --force-remove-reinstreq python3… also failed with:
dpkg: dependency problems prevent removal of python3
I eventually managed to reinstall python3 only with:
sudo apt-get --reinstall install python3
My sad, didactic tale here — see my answer which is what eventually fixed the appearance of the terminal (apparently a lot of things in Ubuntu depend on the version of Python so you should never change those that come with the system).
If you want to see why a particular package was installed, install aptitude and do:
aptitude why <name-of-package>
Short answer is that no, it's not. See here, here, here, and here.
To make matters worse there's no easy way to discover if a package is a meta-package (and thus unsafe to remove — see also here for more).
I use:
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -v ^ii… to find packages with partial installation or uninstallation.
To narrow down to only partially installed packages:
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci]
The description of each field is (source):
The collection of fonts you are able to use is the set of all fonts found under any subdirectory of /usr/share/fonts and ~/.fonts
The above locations are scanned and any font found therein is added to the collection. The following command can be used to refresh the contents of the font cache:
fc-cache -fvYou may have to invoke it both with and without sudo as the effects may be different.
In my system I have cloned the Google fonts repository on my home directory (so the repo resides in ~/fonts). I then did the following:
cd ~/.fonts ln -s ~/fonts fc-cache -fv sudo fc-cache -fv
I did the above in an effort to be able to configure my terminals to use the inconsolata font. Sadly, even though the fc-list command succeeds in finding the inconsolata both in the personal (~/.fonts) and the system-wide (/usr/share/fonts) locations:
$ fc-list | grep -i inconsol /usr/share/fonts/truetype/inconsolata/Inconsolata-Bold.ttf: Inconsolata:style=Bold /home/mperdikeas/.fonts/fonts/ofl/inconsolata/Inconsolata-Regular.ttf: Inconsolata:style=Regular /home/mperdikeas/.fonts/fonts/ofl/inconsolata/Inconsolata-Bold.ttf: Inconsolata:style=Bold /usr/share/fonts/truetype/inconsolata/Inconsolata-Regular.ttf: Inconsolata:style=Regular… and even though Libreoffice finds the font, I still am not able to find it under the profile preferences of the terminal. So symlinking the ~/fonts directory from within ~/.fonts had no effect in my case (I guess that's because I had already copied the font into /usr/share/fonts).
In November 2017 I installed Emacs 25 on Ubuntu 16.04 by first installing a PPA (as described here). It was working fine, but I subsequently decided to unistall it and to remove the PPA I had installed for that purpose alone.
Normally, I would purge the package and remove the PPA. Turns out there's a safer and cleaner approach that allows you to remove a PPA and at the same time gracefully downgrade any pacages it updated (over the official repositories) or any packages installed by it. This alternative is the program ppa-purge. I read about it here.
So that's what I did in two simple commands:
sudo apt-get install ppa-purge sudo ppa-purge ppa:kelleyk/emacs… after the above, emacs25 was no more (without having to explicitly apt-remove it)
Note that the following file:
/etc/apt/sources.list.d/kelleyk-ubuntu-emacs-xenial.list… continued to exist after the above procedure, but all its lines were commented out.
In November 2017 I followed the below procedure to install Emacs 25 on my Ubuntu 16.04 ThinkPad T420 machine:
sudo add-apt-repository ppa:kelleyk/emacs sudo apt-get update sudo apt-get install emacs25
This can be helpful when trying to troubleshoot programmatic MUA (e.g. using the javax.mail.Transport class).
mail -s "subject" john.doe@gmail.comProgram works by typing message body and ending it with a dot, at which point the email is sent out. mail is apparently using the Sendmail MUA (Mail User Agent) and talks to a MSA over SMTP at port 587 or 25 (if still allowed).
It can happen that both the programmatic API and the mail program fail silently (with a 0 exit code) but then, when looking at the /var/log/maillog file one sees "Relaying denied" messages.
df -P -T | awk '{print $NF " " $2}'| grep -v nfs | grep -v mvfsIn the above incantantion we are filtering out the nfs and the MultiVersion File System filesystem types (the latter being used by the shitty ClearCase "product")
There's a number of ways to obtain swap size:
free
$ free -h total used free shared buff/cache available Mem: 7.7G 4.8G 484M 387M 2.5G 2.2G Swap: 7.9G 5.1M 7.9G
/proc
filesystem$ cat /proc/swaps Filename Type Size Used Priority /dev/sda5 partition 8267772 5172 -1
htop
or glance
Obtain current swappiness with:
cat /proc/sys/vm/swappiness
The Ubuntu default value is 60, for a reasonable endowed (memory-wise) system it is recommended to set that value to 10.
Set it with:
sudo sysctl vm.swappiness=10
… following the above I did the following to (temporarily) clear and then turn back on the swap so that the new settings would take full effect:
$ sudo swapoff -a && sudo swapon -a
I had noticed by hard disk light flashing a lot so recently I used:
$ sync $ echo 1 > /proc/sys/vm/block_dump $ dmesg -c | grep '/dev/sda'… don't forget to change the value of /proc/sys/vm/block_dump back to 0 when you're done.
I've also used
iotop --only(the --only option results in much cleaner output). It seems that in my case the culprit was jbd2 which I killed with:
pkill gvfsd-metadata rm -rf .local/share/gvfs-metadata
I basically prepared a USB flash drive with the ISO image of Ubuntu 14.04 LTS using unetbootin:
sudo apt-get install unetbootin sudo unetbootin
… I then inserted the flash drive to a port and tapped F12 when the Dell logo appeared during startup. This is consistent with what is described here under section: 3.Setup the Ubuntu Install:
1. Insert the Ubuntu disk into your DVD drive or connect your Bootable USB into a port on the system.
2. Tap rapidly on the F12 key when you see the Dell logo appear during start up. This will take you to the Boot Once menu.
3. You can use the Cursor/Arrow keys to navigate the menu and highlight your selection. It will be either boot from USB or Boot from CD/DVD Drive. Once your Choice is highlighted hit the ENTER key.
The guy at the store said that for versions of Ubuntu ≥ 14 UEFI should be used instead of BIOS (legacy).
Some quick Googling reveals that the issue is more complicated than that.
Incidentally I have failed to utilize the (expensive) video card — initially I had installed Ubuntu 16.04 and there appears to be an issue with the NVIDIA cards I wasted half a day on it, then gave up.
Subsequently, when I installed Ubuntu 14.04 LTS I think I encountered the problem again but at any rate I finally did not install the NVIDIA drivers at all. Googling just now it seems that 14.04 also has some issues with the NVIDIA drivers. See for instance here.
I wonder if the graphics card problems are related to the fact that the installation was done using UEFI and not BIOS.
You can Google many ways to verify which controller is actually handling graphics — i.e. whether it is the processor built-in controller (Intel in my case) or an external graphics card controller (e.g. Nvidia).
In my case I get:
$ lspci | grep -i vga 00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)… I.e. the built-in Intel controller.
$ sudo apt-get install sshfs $ mkdir /media/local-radacer-repository/ $ sudo sshfs -o allow_other radacer@172.17.12.56:/data /media/local-radacer-repository radacer@172.17.12.56's password: $ ls /media/local-radacer-repository/ total 28 drwxrwxrwx 1 500 500 4096 Feb 19 12:59 ./ drwxrwxrwx 7 root root 4096 May 19 15:39 ../ drwx------ 1 500 500 16384 Feb 17 17:27 lost+found/ drwxrwxr-x 1 500 500 4096 Feb 19 13:02 RADACER/To unmount:
$ sudo fusermount -u /media/local-radacer-repository
$ uname -a Linux beorn 3.16.0-48-generic #64~14.04.1-Ubuntu SMP Thu Aug 20 23:03:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux mperdikeas@beorn:~# $ arch x86_64... the virtualbox program only allowed me to install 32-bit versions of Windows (even though I had installed the 64-bit version of virtualbox).
The solution was to enter the BIOS and enable the following option:
advanced → CPU configuration → secure virtual machine mode
$ mount | grep \ /\ /dev/sda1 on / type ext4 (rw,errors=remount-ro)
$ sudo blockdev --getsize64 /dev/sda1 246855761920NB: this should return a value that's in reasonable agreement with the output of:
df -h .
$ sudo blockdev --getsize /dev/sda1 482140160
$ python Python 2.7.3 (default, Jun 22 2015, 19:43:34) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 246855761920 / 482140160.0 512.0 >>> quit()
/usr/share/gnome/applications/defaults.list
(which is a symlink to
/etc/gnome/defaults.list
) didn't work for me.
/usr/share/applications/defaults.list
(which is different and not symlinked
to the above):
$ sudo cat /usr/share/applications/defaults.list | grep okular application/pdf=okular.desktop
sudo dpkg -i path/to/deb-file.deb
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
sudo apt-get install dkms sudo apt-get install build-essential module-assistant sudo m-a prepare
Host+C
to toggle scale mode (where Host
is Right Control
by default)
cd /media/<username>/VBOXADDITIONS_4.3.10_93012 sudo ./VBoxLinuxAdditions.runJust be sure to replace <username> by the logged in user's username.
sudo mount -o loop path/to/iso/file/YOUR_ISO_FILE.ISO /media/iso
Run the following in a terminal:
xprop | grep -i pidor
xprop | awk '/PID/ {print $3}'… then use the mouse pointer to click on the window you're interested in.
netstat
and lsof
netstat
sudo netstat -pan | grep 8080
lsof
sudo lsof -P | grep 8080
hash
in the shellhash
is a bash built-in command. Last time I used to after installing version
24.5 of Emacs to ensure it gets picked-up:
$hash -rAlso, when called without any arguments it reports how many times you've hit which commands.
sudo apt-get install font-manager
sudo apt-get install cabextract
~/tools/consolas.sh
in a dir where you don't mind the temporary directory temp
that will get created/usr/share/fonts
sudo mkdir /usr/share/fonts/truetype/consolas sudo cp /home/mperdikeas/tools/temp/CONSOLA*.TTF /usr/share/fonts/truetype/consolas
fc-cache
thingsudo fc-cache -fv
$ xrandr -q Screen 0: minimum 320 x 200, current 1280 x 800, maximum 8192 x 8192 LVDS-1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 303mm x 190mm 1280x800 60.0*+ 49.5 1024x768 59.9 800x600 59.9 640x480 59.4 720x400 59.6 640x400 60.0 640x350 59.8 VGA-1 connected (normal left inverted right x axis y axis) 1920x1200 60.0 + 1600x1200 60.0 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.1 60.0 800x600 75.0 60.3 640x480 75.0 60.0 720x400 70.1 DVI-D-1 disconnected (normal left inverted right x axis y axis)
$ xrandr --output VGA-1 --mode 1920x1200At this point, the second (external) monitor shows ouput, but not all the screen is used. I assume this is because the laptop's monitor determines the screen size. So ...
xrandr --output LVDS-1 --offAt this point the external monitor is used fully.
xrandr --output LVDS-1 --auto
NB: To mirror both monitors you do a:
xrandr --output HDMI1 --mode 1920x1080 --output eDP1 --mode 1920x1080 --same-as HDMI1source
sudo apt-get install mpg321 mpg321 song.mp3
sudo apt-get install lame lame --scale 3 song.mp3 song-three-times-louder.mp3
/etc/ssh/sshd_config
file:
# Force SSH Protocol 2 Protocol 2 #Turn on Privileged Separation for security UsePrivilegeSeparation yes #Deny root login PermitRootLogin no #Do not allow empty passwords PermitEmptyPasswords no # Forward my X Sessions X11Forwarding yes X11DisplayOffset 10 # I hate Motd displays PrintMotd no # It's alliivee TCPKeepAlive yesNB: I am not certain the above configuration changes are necessary. Following the above edits, restart the SSH daemon on the remote machine. E.g. for Ubuntu:
sudo /etc/init.d/ssh restart
ssh -D 5222 mperdikeas@mperdikeas.koding.io -NOnce the tunnel is opened, configure your browser to use a SOCKS proxy. E.g. for the above scenario, I've configured Chrome to use as proxy a Socks host at
localhost:5222
.
apt-cache
command. E.g. for the LaTeX package outlines use:
apt-cache search outlines | grep -i latex
sudo add-apt-repository ppa:texlive-backports/ppa sudo apt-get update sudo apt-get install texlive
sudo apt-get upgrade
sudo apt-get install texlive-latex-extra
sudo rsync -avxHAWX --numeric-ids --progress ~ /media/wd-ext4-4T-plank/satl28-home/
rsync -avxHAWX --numeric-ids --progress /media/cc171c39-fbb8-4d49-bd0f-84116ab2b11a/ /media/wd-ext4-4T-plank/planck-disk-1/ > ~/rsync.out
CTRL+ALT+F1
~/.Xauthority
file, and,
sudo reboot
CTRL+ALT+F1... to open a terminal (or F2, F3 ... up to F6 for that matter). Then top or htop tools can then be used to identify the offending process (in terms of CPU or memory utilization); alternatively some window manager may need to be restarted. To return whence you came from use:
CTRL+ALT+F7
ldconfig -p
/proc/meminfo
$ cat /proc/meminfo | grep MemTotal MemTotal: 8215280 kB… or use
free
as in, e.g.:
free -m
sudo fdisk /dev/sda1 -l
sudo dumpe2fs /dev/sda1 | grep 'Block size'More here.
getconf PAGESIZE
echo "a"> a && stat a | head -2In my system I get the following output:
File: `a' Size: 2 Blocks: 8 IO Block: 4096 regular fileIn this example, the stat utility uses the term "blocks" not in the sense of file system blocks but rather to mean an arbitrarily-sized unit, in this case 512 bytes. So the 2 bytes of file "a" (size) require an entire file-system block, which in my system is 4096 (obtained using
sudo dumpe2fs /dev/sda1 | grep 'Block size'
)
and so this translates to 8 512-byte "units" or "Blocks" (in the stat's terminology).
I.e. some Unix utilities use the term "block" without any reference to the file system block size.
df -TFor file systems UUIDs and types:
sudo blkid
cat /etc/fstabUUIDs can then be used to mount volumes automatically (see here).
sudo dumpe2fs /dev/sda1 | grep UUID
sudo blkid /dev/sda1
$ cat /etc/debian_version wheezy/sid(output for my system).
14.10 jessie / sid 14.04 jessie / sid 13.10 Wheezy / sid 13.04 Wheezy / sid 12.10 Wheezy / sid 12.04 Wheezy / sid 11.10 Wheezy / sid 11.04 Squeeze / sid 10.10 Squeeze / sid 10.04 Squeeze / sid(source)
sudo ifconfigTo bring down eth0:
sudo ifconfig eth0 downTo bring it up back again:
sudo ifconfig eth0 up
crontab -eTo view (pipe that to save) such files:
crontab -l
tail -f /var/log/syslog | grep CRON
free -mor
cat /proc/meminfo | grep MemTotal
apt-file search filename
apt-file search /path/to/file
nslookup www.google.com cat /etc/resolve.conf ifdown eth0 sudo /etc/init.d/networking restart cat /etc/network/interfaces ifconfig eth0
kill -15
, followed by a kill -9
See this unix.stackexchange question
nproc
which returns a single integer, or, for a more detailed output: lscpu
du -c $(find . -type f -o -type l -maxdepth 1)so
(sudo) lsof | grep (device name or path to which device is mounted)so
export http_proxy=
is not enough for Rails (e.g. bundle install keeps failing).
You should do a: unset http_proxy
so that prinenv | grep http_proxy
returns no
sign of it.
sudo apt-get update sudo apt-get install bitcoin-qtand maybe 'sudo apt-get install bitcoind'
sudo rm /var/lib/apt/lists/* -vf sudo apt-get update
gksudo software-properties-gtk
sudo add-apt-repository ppa:hotot-team sudo apt-get update
$ env | grep -i proxy http_proxy=http://localhost:9000/ UBUNTU_MENUPROXY=libappmenu.so $ unset http_proxy $ env | grep -i proxy UBUNTU_MENUPROXY=libappmenu.so
$sudo apt-get install iotop $sudo iotop
sudo apt-get install p7zip-fullAnd then:
7z x file.zip... which prompts for password.
$ sudo apt-get install graphviz Reading package lists... Error! E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/apt/lists/es.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en E: The package lists or status file could not be parsed or opened.The following fixes it:
sudo rm /var/lib/apt/lists/* -vf sudo apt-get updateAfter the above two commands sudo apt-get install graphviz succeeds. I think doing a sudo apt-get install upgrade wouldn't hurt either but I didn't try it in this particular case. I also tried it again in a similar situation and was able to sudo apt-get install p7zip-full while it previously failed.
fc-list
xinput --listto find the id of the devices connected to the computer. Then to disable a device (say the built-in keyboard has id 11, do a:
xinput set-int-prop 11 "Device Enabled" 8 0And to enable it back again, do a:
xinput set-int-prop 11 "Device Enabled" 8 1
Before you start, make sure you've unmounted any file systems that were mounted on that device
First of all do a sudo -i. Then, use two commands: fdisk followed by a mkfs.ext3 First, do a:lsblk... to find the device names and the partitions. In my case I had three (3) partitions on the same external USB HDD: /dev/sdg1/, /dev/sdg2 and /dev/sdg3. I then did a:
fdisk /dev/sdgto create a single partition (m to list the available commands, p to list existing partitions, d to delete partitions, n to create a new partition and w to write the partition table). This was followed by a:
mkfs.ext3 /dev/sdg1... on the single partition I created. Finally, to label the drive I did a:
sudo e2label /dev/sdg1 150GB-USB-hdd
NB: more recently I just did a:
mkfs.ext3 -L volume-label /dev/sdg1to format and label the volume in one step without needing to use e2label.
NB2
You may not be able to write to this disk as normal user as root may own it,
but just doing chown user:user /media/volume-name
or chmod -R a+rwx /media/volume-name
will do the trick.
NB3
It is important that the fdisk is performed on the entire device (as in fdisk /dev/sdg
)
but that mkfs.ext3 is performed on a single partition (as in mkfs.ext3 .. /dev/sdg1
).
Doing the mkfs.ext3 on the entire
device would still work but then the fdisk -l command will complain about not being able
to find the file system type.
NB4
To confirm that you've correctly formated the flash drive do
a sudo blkid
afterwards (this works whether the
drive is mounted or unmounted)
2018, April. I did the following to format to FAT32 a Transcend 8GB USB flash drive (which I intended to use to create a bootable Ubuntu 16.04 flash drive):
sudo fdisk /dev/sdbIn the step above I followed the sequence of steps described above to list the existing partitions (p), delete the existing partition (d) and then create a new partition (n) and, finally, write the partition table (w).
This was then followed by:
sudo mkfs.fat -F 32 /dev/sdb1to create a FAT32 file-system on the flash drive.
However, I was unable to label it. I tried:
sudo fatlabel /dev/sdb TRANS-8GB… but it wasn't working. However, I tried again later using:
sudo fatlabel /dev/sdb1 TRNSND8BLAC… (as advised here) and it worked like a charm (on the second try). The difference was that the second incantation used the partition, not the entire device, and that filesystem was dismounted when I tried the second incantation.
At any rate notice again how
(as advised above) fdisk
is performed on the entire disk whereas mkfs
on a single partition.
2019, May I encountered some problems with the above procedure in that the thumb drive I created (even though FAT32) wasn't readable from a High Sierra MacBook Air. To fix that I first completely erased and re-formatted the USB thumb drive using the gnome-disks program before proceeding with the April 2018 procedure. I still couldn't get the High Sierra machine to read it. I then formatted it on the Mac using the simple FAT filesystem and at that point it worked in both Ubuntu and MacOS.
2021, May While trying to format a brand-new SanDisk 256G thumb drive I encountered problems with the above procedure. Specifically, the following step:
$ sudo mkfs.ext3 -L san256G /dev/sdc1… became stuck at the point where the journal get's created:
Creating journal (262144 blocks):To get around this problem I formated the drive in ext4 as follows:
$ sudo mkfs.ext4 -L san256G -F /dev/sdc1NB5 As always, you must remember to first delete the existing partitions, then create a new partition (just accept the defaults) and write it on the drive using:
$ sudo fdisk /dev/sdcOnly after the above step (which has always succeeded in my experience) should you go ahead with the mkfs.ext4 tool.
tail --bytes=+4 text.txt
rdesktop -a 16 -f 192.168.0.2a for color depth (16 bits), f for full-screen
for x in $(find . -iname \*.java) ; do iconv --from-code=ISO-8859-2 --to-code=UTF-8 $x > $x.boo ; done
for i in $(find . -iname \*.java.boo) ; do mv -v $i ${i%.java.boo}.java ; doneNOTE: before the previous I had the following which doesn't work as it does the renames to the local folder:
for i in $(find . -iname \*.java.boo) ; do mv "$i" "`basename $i .java.boo`.java"; done
dpkg -s postgresql
fc-list
dmesg | tail.. to identify the device (/dev/sdc1 in my system)
df
sudo umount /dev/sdc1
sudo mkfs.ext3 -n 'name' /dev/sdc1Note, sometimes -n is not understood and the following works instead: sudo mkfs.ext3 /dev/sdc1
sudo mkfs -t vfat /dev/sdb1
sudo lsof -P -i -n
ldd $(which wget)
ldd /usr/lib/libappindicator3.so.1
date -d @23948239
date +%s date -d "Dec 24 1974" +%s
xdg-open .
echo $LANG en_US.UTF-8The first component of the environment variable specifies the collation which dictates: (a) lowercase / uppercase logic, (b) ordering logic, (c) maybe, default codepage. The second component is the encoding. LANG should be set to the same value as the LC_ALL otherwise some instabilities may be observed.
In my machine it is currently:
$echo $LANG en_US.UTF-8As a result everything that's inputed from the keyboard or output to the keyboard is converted automatically to UTF-8 (this is analogous to the 'Regional Settings' in Windows machines).
To experiment do a:
cat > datatestand type-in some Greek characters. The command file on my machine then yields:
file datatest datatest: UTF-8 Unicode textIf the file is converted to a Greek codepage, with:
iconv -f utf-8 -t iso8859-7 < datatest > greek.. file then duly reports:
file greek greek: ISO-8859 text.. and cating the file produces garbage on the console.
~/.local/share/applications/defaults.listAdd or edit the following text:
[Default Applications] text/plain=emacs
348 cd /home/mperdikeas/virtual-machines/vm/ 349 l 350 ls -ltra 351 l *lck 352 mv *lck /var/tmp/ 353 ls -ltra 354 mv caches/ /var/tmp/ 355 ls -ltra 356 mv *vmem /var/tmp/ 357 l 358 chown root.root * 359 l 360 chmod 644 * 361 l 362 vmplayer Windows\ XP\ Professional.vmx
cat .ssh/id_dsa.pub (grep with mouse) cat >> .ssh/authorized_keys
smbclient -U a_tsiodras -L //172.31.128.250Occassionally, this might give a:
session setup failed: NT_STATUS_LOGON_FAILUREif the server is not configured to provide a listing of the shared folders. In these cases, the only recourse is to know the shared folder names and directly mount them as shown on the below item.
sudo mount -t cifs -o username=a_tsiodras //172.31.128.250/Download /iso2/
sudo apt-get install apt-file sudo apt-file update apt-file search /usr/bin/mysqldump(SO answer)
dpkg -S /bin/ls
$ echo $LANG en_US.UTF-8
sudo fdisk -lUnmount the drive in question and format it, e.g. in NTFS:
sudo mkfs -t ntfs /dev/sdg1
sudo blkid
sudo apt-get update && sudo apt-get upgrade --allow-unauthenticated(source)
strace -f ./NeuroCode.exe Project.xml 2>&1 | less
lsmod
sudo sh VMware-Player-5.0.0-812388.i386.bundle
sudo tail -f /var/log/syslog
The umount command shows all mounted filesystems.
If an external HDD is not visible even at the output of fdisk -l this means that it is not visible, even as a device, which strongly suggests that the USB port itself may have been fried. I suppose a fried USB port could be diagnosed by the output of the lsusb command.
id -u johnFor more information, includiing group id:
id john
wget -q -O - http://emacs.naquadah.org/key.gpg | sudo apt-key add -
lsusb
dmesg
apt-get remove --purge [appname] apt-get autoremove [appname] apt-get clean apt-get autocleanupdate 29.VIII.2012: ttsiodras recommends this:
dpkg -P [packagename]
sudo dpkg -i package.deb
1st way. Either: (a) using /etc/rc.local for things that are supposed to simply be run at startup, and (b) the init.d scripts - and their symlinks under runlevels /etc/rc{3,5}.d - for everything else.
2nd way. There's also something without the complexity of startup scripts, which is much easier to use when you want to start/stop your process as if it is a daemon: "supervisor" ( http://supervisord.org/ ):
[program:yourapp] command=/path/to/app --option1 ... user=yourapp directory=/apps/yourapp
You add the file to /etc/supervisor/conf.d/, make a "supervisorctl update" and your service is up an running. It's a no-brainer and much easier than juggling rc.d scripts. Crash recovery and optional web interface included.
ps ax | grep httpd | grep -v grep
sudo apt-get remove --purge apache2 apache2-utils sudo apt-get install apache2
dpkg --get-selections
dpkg -S ldapsearch
dpkg-query -L <package name> apt-file list <package name>
dpkg -L httpd
end of update
(-L lists all files installed to your system from that package name)
dpkg -L python2.7 ls -s /usr/lib/python2.7/To find which packages are installed (so you can then do a
dpkg -L
on them, do a:
dpkg --get-selections
ls | grep ^d
find . -type f -print0 | xargs -0 du -sb | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
(for directories just use '-type d' instead of '-type f')
du * | sort -nor..
du --max-depth=1 * | sort -n.. or ..
du --max-depth=1 | sort -n('*' is really redundant)
cat /etc/passwd | cut -d ":" -f1