change file name ubuntu code example
Example 1: how to rename a file in ubuntu using terminal
mv oldnamefile1 newnamefile1
Example 2: linux change hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot
Example 3: how to rename a file in terminal
mv "old location" "new location"
mv /home/user/my_static /home/user/static
mv "file1.ext" "file2.ext"
Example 4: change username ubuntu
# -l changes login name
# -d changes home directory
# -m copies over contents from old home directory
usermod -l <newname> -d /home/<newname> -m <oldname>
# NOTE: will not work if you are currently logged on as user
# - workaround by temporarily enabling root account and running above command there
# [sudo passwd root]
# - after root account has been used to change username lock it using
# [sudo passwd -l root]